public class Singleton { private static class Holder { private static final Singleton instance = new Singleton(); } private Singleton() { } public static Singleton getInstance() { return Holder.instance; }}
本文共 290 字,大约阅读时间需要 1 分钟。
public class Singleton { private static class Holder { private static final Singleton instance = new Singleton(); } private Singleton() { } public static Singleton getInstance() { return Holder.instance; }}
转载于:https://my.oschina.net/wangyongqing/blog/127810