摘要:
ArrayList线程不安全例子: public class ListTest { public static void main(String[] args) { List<String> list = Collections.synchronizedList(new ArrayList<>()) 阅读全文
摘要:
demo: public class T1 { volatile int n = 0; public void add() { n++; } } Compiled from "T1.java" public class com.shishi.jmm.T1 { volatile int n; publ 阅读全文