How do you stop a dog from nipping and biting?

If you start going bad dog or telling it off it will eventually stop