The puzzle of the black and white hats

CA GOPAL GUPTA (student) (715 Points)

03 September 2011  

Image

 

Four men are lined up on some steps. They are all facing in the same direction. A wall seperates the fourth man from the other three. 
So to summarise :-

Man 1 can see men 2 and 3. 
Man 2 can see man 3. 
Man 3 can see none of the others. 
Man 4 can see none of the others. 

The men are wearing hats. They are told that there are two white hats and two black hats. The men initally don't know what colour hat they are wearing. They are told to shout out the colour of the hat that they are wearing as soon as they know for certain what colour it is.
They are not allowed to turn round.

They are not allowed to talk to each other.


So the question is -
Who is the first person to shout out and why?