public class Singleton {
private static class SingletonHolder {
private static final Singleton INSTANCE = new Singleton();
}
private Singleton (){}
public static final Singleton getInstance() {
return SingletonHolder.INSTANCE;
}
}
转载:https://juejin.cn/post/6844903606659842055#heading-7
https://juejin.cn/post/6844903875443458062