public class ThreadTest {
public static void main(String[] args) { final AtomicInteger atomicInteger = new AtomicInteger(0); for (int i = 0; i < 1000; i++) { new Thread(new Runnable() { @Override public void run() { atomicInteger.getAndIncrement(); } }).start(); } System.out.println(atomicInteger.toString()); }
}
慕标5832272
开满天机
牛魔王的故事
胡子哥哥
相关分类