随笔分类 -  Core Java

单例模式的七种写法
摘要:Java:单例模式的七种写法转载出处:http://cantellow.javaeye.com/blog/838473第一种(懒汉,线程不安全): 1 public class Singleton { 2 private static Singleton instance; 3 private Singleton (){} 4 5 public static Singleton getInstance() { 6 if (instance == null) { 7 instance = new Singleton(); 8 } 9 ... 阅读全文
posted @ 2013-06-19 22:40 idylan 阅读(522) 评论(0) 推荐(0) 编辑