Cognizant interview question

How synchronization works in java