@synchronized lock is always the object, the value of the object, can only lock the object, constants and so on can not be added synchronized, once compiled will not pass
@synchronized the non-static in the lock object is the object that the lock calls the method, the entire object
The static method in @synchronized lock object is to lock the entire class, and synchronized (X.class) and the lock static code block are all the same as the lock class loader to the object of this class, remember that this class object is not our own new class object, and Is the object that the JVM uses to load this class, and 2 is not the same.
@synchronized lock a property in an object, this property must also be an object, not a constant, such as a collection, and the synchronized (set) has nothing to do with this object, because the set is in this object, but synchronized The object is a locked object, that is, the collection object, so it is not related to the large object where the property is located, that is, when a small object in a large object is locked, the other properties or methods in that large object are accessible, not affected by that lock small object.
The true meaning of synchronized