About the method in the java class plus synchronized modification

Among the different methods of a class, all methods share a semaphore.

Adding synchronized modification to two different methods means that the two methods share a lock, that is, a semaphore. In this way, the two methods with synchronized can be mutually exclusive!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325649263&siteId=291194637