9's are cheaper to buy,, and ammo is cheaper,, also less recoil than a 40. But there are a few variables to keep in mind.
What is it going to be its primary function? Range/fun? Self/home defense? How big are your hands/frame?
For fun you might go with the 9, ammo cheap so you can shoot a lot.
Self/ home defense I would go with the 40, double tap center mass most likely to stop threat better than 9.( although I'm sure 9's can get it done too )
Single stack magazines are slim inthe hand, double stacks are fatter so it may make a difference if you have small hands.
Either way, get one and practice, practice till you know that perticular weapon inside and out. ..have fun!!!