懒汉式(使用时创建,线程安全)
class Singleton{
private Singleton() {}
pribate static class Holder{
static Singletion s = new Singleton();
}
public static Singleton Instance(){
return Holder.s;
}
}
懒汉式(使用时创建,线程安全)
class Singleton{
private Singleton() {}
pribate static class Holder{
static Singletion s = new Singleton();
}
public static Singleton Instance(){
return Holder.s;
}
}