实现单例的一种常用方法(,)是使用具有静态成员的内部类: private static class SingletonHolder {public static final Singleton instance = new Singleton();
public static SingletongetInstance()
可能重复:
if(singleton==null) { synchronized(Singleton.class) { // this is needed if two threadsare waiting at the monitor at the // time when singleton was getting instantiated if(sing