What is the difference between a synchronized method and synchronized block in Java? [duplicate]

A synchronized method uses the method receiver as a lock (i.e. this for non static methods, and the enclosing class for static methods). Synchronized blocks uses the expression as a lock. So the following two methods are equivalent from locking prospective: synchronized void mymethod() { … } void mymethod() { synchronized (this) { … } … Read more