public class Singleton { private Singleton() {} private static final class Holder{ static final Singleton singleton=new Singleton(); } public static Singleton getInstance() { return Holder.singleton; } }
public class Singleton { private Singleton() {} private static final class Holder{ static final Singleton singleton=new Singleton(); } public static Singleton getInstance() { return Holder.singleton; } }