简直惊艳。
public class Singleton{
private Singleton(){
System.out.println("I'm creating")
}
private static class SingletonHolder{
private static Singleton instance = new Singleton();
}
public static Singleton getInstance(){
return SingletonHolder.instance;
}
}