愤怒中的小草

博客园 首页 新随笔 联系 订阅 管理

2019年3月20日 #

摘要: public class ReentrantDemo { //重入锁 保护临界区资源count,确保多线程对count操作的安全性 /*public static ReentrantLock rtlock = new ReentrantLock(); public static int count = 0; Thread t = new Thread(new Ru... 阅读全文
posted @ 2019-03-20 09:54 愤怒中的小草 阅读(125) 评论(0) 推荐(0) 编辑

摘要: public class InternDemo { public static void main(String[] args){ /* jdk7版本之后 字符串常量池从Perm Space移到Java Heap */ //生成两个对象 String s1 = new String("aaa"); ... 阅读全文
posted @ 2019-03-20 09:53 愤怒中的小草 阅读(208) 评论(0) 推荐(0) 编辑