摘要: 反射调用私有构造器创建对象 Class c=hungrysingleton.class; Constructor constructor=c.getDeclaredConstructor(); constructor.setAccessible(true);//入侵 hungrysingleton h1= (hungrysinglet... 阅读全文
posted @ 2019-06-20 23:46 黑魔法os 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 恶汉模式public class hungrysingleton implements Serializable{ private final static hungrysingleton h; static { h=new hungrysingleton(); } private hungrysi 阅读全文
posted @ 2019-06-20 23:42 黑魔法os 阅读(123) 评论(0) 推荐(0) 编辑