摘要: class TrafficLight{ private String lightType; private static final TrafficLight GREENLIGHT = new TrafficLight("GreenLight"); private static f... 阅读全文
posted @ 2015-12-09 16:32 finalboss1987 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 核心是私有构造方法。class Singleton{ private static Singleton obj = new Singleton(); private Singleton(){} public static Singleton getInstance(){ ... 阅读全文
posted @ 2015-12-09 16:04 finalboss1987 阅读(274) 评论(0) 推荐(0) 编辑