Siva Masilamani wrote:Then could you please explain what they are trying to point out here
"with either fragment the first output must be Yo"
Dudes instance created in go() has no synchronization associated with it. There is absolutely no guarantee which thread will execute flag = id first even when using synchronized keyword. It could be any of the threads who enter the block first.