public static GameControl gc = null; //引用public GameControl(){
gc = this;
}public GameControl getGameControl(){
if(gc == null){
gc = new GameControl();
}
return gc;
}请问各位大侠,构造方法,与new 创建一个对象再返回去,他们返回的是同一个对象吗?
gc = this;
}public GameControl getGameControl(){
if(gc == null){
gc = new GameControl();
}
return gc;
}请问各位大侠,构造方法,与new 创建一个对象再返回去,他们返回的是同一个对象吗?
private static GameControl gameControl = null;
private GameControl(){
};
public static synchronized GameControl getInstance(){
if(null == gc){
gc = new GameControl();
}
return gc;
}