![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
sjp_359056
这个作者很懒,什么都没留下…
展开
-
设计模式--单例模式
1.恶汉式:静态常量 单例的实例被声明称static和final,在类加载到内存的就是就被初始化了,同时也是线程安全的public class Singleton1 { private final static Singleton1 instance = new Singleton1(); private Singleton1(){} public ...转载 2018-04-17 10:30:38 · 93 阅读 · 0 评论 -
设计模式--工厂模式
抽象工厂模式: 1.简单工厂模式在实际中并不实用且缺点较明显。 2.工厂方法模式解决了简单工厂不能实现“开闭原则”的弊端,但是代码会比较冗余。 3.抽象工厂模式:Provide an interface for creating families of related or dependent objects without specifying their...原创 2018-04-19 19:40:38 · 79 阅读 · 0 评论