首页 > 代码库 > 内部类实现懒加载

内部类实现懒加载

public class Singleton{ private Singleton(){ … } private static class SingletonContainer{ private static Singleton instance = new Singleton(); } public static Singleton getInstance(){ return SingletonContainer.instance; } }

内部类实现懒加载