Block Synchronization in java | Core Java Tutorials

This “Block synchronization in java” page is providing clear information about how to synchronize a specific block to synchronize in thread programming.


Block synchronization :

  • Synchronized block is used to lock an object for any shared resource.
  • Scope of synchronized block is smaller than the method.
  • Generally we synchronize methods as shown in the above discussion.
  • Block synchronization is used to synchronize a set of lines of code in a method.
  • If you put all the codes of the method in the synchronized block, it will work same as the synchronized method.


Share this