package org.example.dp;
public class Singleton {
private Singleton() {}
private static class LazySingleton {
private static final Singleton INSTANCE = new Singleton();
}
public static Singleton getInstance() {
return LazySingleton.INSTANCE;
}
}
设计模式之单例模式 Singleton
最新推荐文章于 2022-07-07 13:10:50 发布