synchronized

  当修饰静态方法的时候,锁定的是当前类的Class对象。

 当修饰非静态方法的时候,锁定的是当前的实例对象this。

原文地址:https://www.cnblogs.com/prader6/p/15273076.html