public class MyObject{ private static MyObject instance = null;
public static MyObject getInstance(){ if (instance == null) instance = new MyObject(); return instance; } //private, you can't create new instance by yourself private MyObject(){ .... } }
private static MyObject instance = null;
public static MyObject getInstance(){
if (instance == null) instance = new MyObject();
return instance;
} //private, you can't create new instance by yourself
private MyObject(){
....
}
}
系统是采取排队还是随机,还是其它?