There synchronized static method and the method of Java_ synchronized multi-threaded _ a class at the same time, these two methods sync?

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/Chill_Lyn/article/details/102764638

Not synchronized

  • The difference between a static method and member method is a static method belonging class member method belongs to the object
  • synchronized method lock is the current object
  • If it is static synchronized method lock is Class object class, which means that all objects of that class will be genlock.
  • If an ordinary synchronization method, that is locked object calls this method, only one object is synchronized locked.

Guess you like

Origin blog.csdn.net/Chill_Lyn/article/details/102764638