★★Java質問・相談スレッド172★★ [転載禁止]©5ch.io
■ このスレッドは過去ログ倉庫に格納されています
0752デフォルトの名無しさん
2015/03/31(火) 23:51:59.78ID:ljD0qB8yprivate final int foo;
private static SingletonTest instance = null;
private SingletonTest(int foo) {
this.foo = foo; //←これ
}
public static SingletonTest getInstance(int foo) {
return (instance == null) ? instance = new SingletonTest(foo) : instance;
}
public static SingletonTest getInstance() {
return (instance == null) ? newInstance(1) : instance;
}
}
■ このスレッドは過去ログ倉庫に格納されています