Interview Questions

What is Synchronized method?

Synchronized methods are the one which can be accessed by only one Thread at a time. If a particular thread is accessing a Synchronized method, and if another thread needs to access the same method, then it has to wait until the first thread releases the lock on the method. Only then the second thread can access the same method.

Synchronized keyword is applicable only to methods. It cannot be used in variables, classes, parameters etc.