What is the best way to: How do you hang a shelf?

OPTIONS: a). Get shelf hanger brackets, when you see where you want to hang it hammer nails in the wall and screw the brackets on.. b). Get shelf hanger brackets, when you see where you want to hang it drill holes in the wall and screw the brackets on..
Answer:
b).