0 votes
What is difference between synchronized method and block?

1 Answer

0 votes
A synchronized method locks on the object instance the method is contained in while a synchronized block can lock on ANY object. For synchronized methods, the lock will be held throughout the method scope, while in the synchronized block, the lock is held only during that block scope also known as critical section.
...