'What is difference between synchronized(this) vs synchronized(class) in Java [duplicate]

What is difference between synchronized(this) vs synchronized(class) in Java.As per my belief synchronized(Class) will take lock on whole class.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source