In which cases we need to synchronize a method?

后端 未结 0 2018
野的像风
野的像风 2021-01-03 06:55

Let\'s say I have the following code in Java

public class SynchronizedCounter {
    private int c = 0;

    public synchronized void increment() {
        c++         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题