写一个懒汉式延迟加载单例设计示例(面试)
2017-12-20 本文已影响0人
menmo_O
必背
class Single
{
private static Single s =null;
private Single(){}
public static Single getInstance()
{
if(s==null)
{
synchronized(Single.class)
{
if(s==null)
--->A
s = new Single();
}
}
return s;
}
}