本帖最后由 小洋人最happy 于 2012-11-24 12:10 编辑
class Single
{
private static final Single s = new Single; 什么意思
private Single(){} 什么意思
public static Single getInstance()什么意思
{
return s;
}
}
class Single2
{
private static Single s = null;什么意思
private Single(){} 什么意思
public static Single getInstance()
{
if(s==null)什么意思
{
s = new Single;什么意思
}
return s;
}
}
还是不太明白两者有什么区别?
|