Yes, if it is a static method, the class is locked, that is, all instances of the class can only be accessed by one person. If it is a normal method, the object is locked.
The synchronized keyword locks the object, that is, the object lock. The static method can be considered to obtain the lock of the corresponding Class object. When multiple threads compete for the lock of an object, only one will get the lock.
Yes, it is this object that is locked, not a method.
Yes, if it is a static method, the class is locked, that is, all instances of the class can only be accessed by one person. If it is a normal method, the object is locked.
The synchronized keyword locks the object, that is, the object lock. The static method can be considered to obtain the lock of the corresponding Class object. When multiple threads compete for the lock of an object, only one will get the lock.