设计模式] 单例模式
最编程
2024-10-01 07:20:46
...
public class Singleton {
//私有化构造函数
private Singleton(){}
private static Singleton instance = null;
static {
instance = new Singleton();
}
public static Singleton getInstance(){
return instance;
}
}