A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Synchronization in multithreading

Synchronization

  • It is a modifier, applicable only for methods and blocks. But not for classes and variables. 
  • if multiple threads trying to operate simultaneously on the same java object then there may be a chance of data Inconsistency problem. 
  • To overcome this problem, we will use synchronized keyword. 
  • If methods or blocks declared as synchronized then at a time only one thread is allowed to execute that method or blocked on the given object.

LEARN TUTORIALS

.

.