Popular Posts

Saturday, July 16, 2011

JAVA - synchronized

synchronized methods acquire lock on objects.


Here "my" and "yours" are two different instances, so "my" threads willl acquire lock on "my" instance and "yours" threads will acquire lock on "yours" instance.

Example is shown below:

No comments:

Post a Comment