Google News
logo
Java Multithreading - Interview Questions
What is the synchronization process? Why use it?
Synchronization is basically a process in java that enables a simple strategy for avoiding thread interference and memory consistency errors. This process makes sure that resource will be only used one thread at a time when one thread tries to access a shared resource. It can be achieved in three different ways as given below: 
 
* By the synchronized method
* By synchronized block
* By static synchronization

Syntax :  
synchronized (object) 
{        
   //statement to be synchronized 
}
Advertisement