I probably don't even need to respond since most of the other responses seem to be saying what I would - mainly be consistent, and don't get too emotional or give him too much attention for it. I combine the 'leave the room' and the 'time out' approaches - when my son does something like that (he's just about the same age as yours), I say no hitting in a very serious voice and put him in the playpen and leave the room for a few minutes. I also make sure that there are no toys in the playpen, and that the TV is off, so that he doesn't have anything to entertain himself, so he gets a bit upset. Then if he does it again, I put him right back in the playpen. It takes a few rounds of this sometimes, because they're still learning cause and effect at this age. But this method works really well for me, and it has taught my son to stay off the stairs. Every time he would start up the stairs after I said no, I put him right in the playpen and he threw a fit. After a few rounds of this, he would walk over to the stairs, point, and say 'no-no.' Another thing that I've done that some moms might think is cheating, is that I pretend to cry if he hits me or throws something at me. I guess he's at the age where empathy kicks in, because if I'm 'crying,' he stops what he's doing and comes to see my boo-boo. He also looks sad when I do this, so I think he's upset that I'm 'hurt' and usually stops the behavior. Last night he threw a car at me and it sliced open my hand. Not sure how that happened since it's a kids' toy... but I pretended to cry, and then Daddy kissed my boo-boo, so my son came and kissed it too, and he put the car away and didn't throw it anymore.
Sorry for such a long post. :-) Best of luck with this, and just remember to be consistent and patient. He'll learn.