摘要: public class SingletonDemo5 implements Serializable{ private static SingletonDemo5 instance; //防止单例被反射 private SingletonDemo5(){ if(null!=instance){ t 阅读全文
posted @ 2017-01-05 14:11 耳朵像图图 阅读(497) 评论(0) 推荐(0) 编辑
摘要: /** * 测试单例模式:恶汉式 * 有点:线程安全,效率低,类一加载的时候就new对象 * @author codeMan * */public class SingletonDemo1 { private static SingletonDemo1 instance=new SingletonD 阅读全文
posted @ 2017-01-05 12:30 耳朵像图图 阅读(281) 评论(0) 推荐(0) 编辑