摘要: ArrayList线程不安全例子: public class ListTest { public static void main(String[] args) { List<String> list = Collections.synchronizedList(new ArrayList<>()) 阅读全文
posted @ 2021-06-18 19:52 圣金巫灵 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2021-06-18 00:27 圣金巫灵 阅读(48) 评论(0) 推荐(0) 编辑