How can I prevent hostile mobs from spawning?

Set the difficulty to Peaceful.


I heard lighting torches in caves scares the monsters away.