I'm trying to understand the exact differences in synchronisation using:
synchronized(MyClass.class){...}
synchronized(myClassInstance.getClass()){...}
[edited asMyClass.getClass()
doesn't even compile]synchronized(this){...}
Thanks to other posts I get that (1) is used to make sure that there is exactly one thread in the block and that (3) ensures that there is exactly one thread per instance.
(see Java Synchronized Block for .class )
But what does (2) do? Is it identical to (3)?