04 2017 档案

摘要:本文转自:http://www.cnblogs.com/dolphin0520/p/3920373.html volatile这个关键字可能很多朋友都听说过,或许也都用过。在Java 5之前,它是一个备受争议的关键字,因为在程序中使用它往往会导致出人意料的结果。在Java 5之后,volatile关 阅读全文
posted @ 2017-04-24 20:33 默默生长的蘑菇 阅读(139) 评论(0) 推荐(0)
摘要:方法1:用while循环和变量实现 方法2:用synchronized、wait、notifyAll实现 static int index = 1; public static void main(String[] args) throws InterruptedException { final 阅读全文
posted @ 2017-04-22 14:24 默默生长的蘑菇 阅读(1538) 评论(0) 推荐(0)