class Singleton{
private Singleton(){}
private static class LazyHolder{
public static Singleton singleton = new Singleton();
}
public static Singleton getInstance(){
return LazyHolder.singleton;
}
}
单例模式
最新推荐文章于 2025-05-23 19:33:43 发布