单例模式,工厂模式,代理模式汇总

1.单例模式: 饿汉式 (可用) public class Demo{ private static Demo demo = new Demo(); private Demo(){ } public static Demo getInstance(){ return demo; } } 懒汉式双锁(不可用) public class Demo{ private static Demo demo;
相关文章
相关标签/搜索