62,614
社区成员
发帖
与我相关
我的任务
分享
class Singleton {
private static Singleton instance = null;
private Singleton() {
// do something
}
public static Singleton getInstance() {
if (instance == null) {
instance = new Singleton();
}
return instance;
}
}
class A {
private static A = new A();
private A() {
//这里的处理相当的复杂,而且很耗资源
}
public static A getA() {
return A
}
}