Synchronized static method in MyClass is essentially the same as synchronized(MyClass.class) block. Your second example should be rewritten as
synchronized(Foo.class) {
}
to be correct.
If you would like to be defensive about your class synchronization, you should synchronize on a private static object not visible outside your class. This prevents malicious code from blocking your static methods by executing synchronized on their class object, thus blocking the legitimate method.
As far as "locking all objects" goes, non-static methods marked synchronized will not be locked by execution of a static synchronized method, because regular synchronized methods lock on an instance of the object, not on its class.
Classobject. I'm not sure if I understand your second question correctly, could you please restate it?Classobject. 2) It should really besynchronized(Foo.class)