Java synchronized block is better than java synchronized method in java because by using synchronized block you can only lock critical section of code and avoid locking whole method which can possibly degrade performance. A good example of java synchronization around this concept is getInstance() method Singleton class. See here.

Read more: http://javarevisited.blogspot.com/2011/04/synchronization-in-java-synchronized.html#ixzz1vrNbXwS6

Advertisements