延迟加载的单例设计模式

来源:互联网 发布:深圳缇嘉服饰淘宝店铺 编辑:程序博客网 时间:2024/05/18 03:00

class Single

{

private static Single s=null;

private  Single(){}

private static  Single getInstance()

{

if(s==null)

synchronized(Single.class)

{

if(s==null)

s=new Single();

}

return s;

}




}

0 0
原创粉丝点击