
设计模式
文章平均质量分 56
扬帆丶起航
乘风破浪会有时,直挂云帆济沧海
展开
-
Java设计模式【单例模式】
懒汉式 public class Singleton { private static Singleton instance = null; private Singleton() { } public static Singleton getInstance() { if (instance == null) { instance = new Singleton(); } return instance; } } 不加同步的懒汉式是线程不安全的 线程安全的原创 2021-03-01 14:41:07 · 129 阅读 · 2 评论 -
Java设计模式【工厂模式】
普通工厂模式原创 2021-02-28 14:04:32 · 112 阅读 · 0 评论