/*
* 单例设计模式之懒汉式 延迟加载
*/
public class Single {
private static Single s;0x1111
private Single(){}
public static Single getSingle(){
if(s == null){
synchronized (Single.class) {
if(s == null){
s = new Single();//0x1111
}
}
}
return s;
}
}
/*
* 单例设计模式之饿汉式
*/
public class Single {
private static Single s = new Single();
private Single(){}
public static Single getSingle(){
return s;
}
}