Dogs who bark and growl often do so because they were not properly socialized as youngsters. Taking your puppy out for frequent walks, participating in obedience classes and visiting dog parks help your dog learn that other dogs and people are friends, and don't require aggressive behavior on his behalf. Once your dog has developed the habit of barking and growling, it will take a combination of socialization and training to quiet him down.
Provide plenty of exercise. Bad behavior often stems from excess energy. Provide several sessions of aerobic activity every day. You can walk your dog, play fetch or other active games with him, or do obedience work, but he needs to be up and moving during this time.
Socialize your dog. It isn't too late to get him out and about. Start by taking him out to a relatively controlled area, as spots with lots of dogs or children playing will probably agitate him and encourage bad behavior. As he gets more accustomed to noise and activity, start visiting more crowded areas.
Interrupt him when he barks and growls. Instead of teaching the dog to be quiet, punishing a dog will make him more aggressive or anxious, and more likely to bark. Instead, keep him busy. When you are walking him, as soon as he starts to bark, make a quick U-turn and walk the other way. Do figure eights, turn and stop, anything to keep his mind busy.
Disrupt his barking while he is loose in the house or yard. When he is not on lead, your options for quieting your dog down are more limited. Use a spray bottle and spritz him with water or toss a shake can near him to distract him and stop the barking.