摘要:
class TrafficLight{ private String lightType; private static final TrafficLight GREENLIGHT = new TrafficLight("GreenLight"); private static f... 阅读全文
摘要:
核心是私有构造方法。class Singleton{ private static Singleton obj = new Singleton(); private Singleton(){} public static Singleton getInstance(){ ... 阅读全文