1.饿汉式
2.懒汉式
3.饿汉式双重检查锁
4.静态内部类实现单例模式 IoDH
public class Singleton(){
private Singleto(){}
private static class HolderClass{
private final static Singleton instance = new Singleton();
}
public static Singleton getInstance(){
return HolerClass.instance;
}
}