欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

懒汉单例模式创新,懒汉模式创新,/** * 懒汉单例模

来源: javaer 分享于  点击 34206 次 点评:19

懒汉单例模式创新,懒汉模式创新,/** * 懒汉单例模


/** *  懒汉单例模式创新(线程安全) *  只有在调用的时候才会初始化   */public class LazySuperSingleton {    static class SingletonHolder {        static LazySuperSingleton instance = new LazySuperSingleton();    }    public static LazySuperSingleton getInstance() {        return SingletonHolder.instance;    }}//该片段来自于http://byrx.net
相关栏目:

用户点评