posted 12 years ago
In the first code snippet, code is synchronized on object referred by someObject. So, if two(or more) threads are having same reference someObject, then only one thread at a time can enter in synchronized block.
In the second code snippet, code is synchronized on object referred by MyClass.class.
If you have any doubts regarding synchronization, I would suggest to go through link provided in previous post by Martin Vajsar.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)