Interview Question in Java


 

Interview Question :: What are synchronized methods and synchronized statements?

 What are synchronized methods and synchronized statements?

by ksk
VoteNowAnswers to "What are synchronized methods and synchronized statements?"

 Synchronized methods are methods that are declared with the keyword synchronized. thread executes a synchronized method only after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. It is a block of code declared with synchronized keyword. A synchronized statement can be executed only after a thread has acquired the lock for the object or class referenced in the synchronized statement.

by ksk