摘要: [设计模式]单例模式 一、饿汉式 public class Hungry { //浪费空间 private byte[] data1 = new byte[1024*1024]; private Hungry(){ } private static Hungry hungry = new Hungr 阅读全文
posted @ 2020-05-31 19:16 柏伯伯 阅读(99) 评论(0) 推荐(0)
摘要: [设计模式]工厂模式 一、简单工厂模式(静态工厂模式) 车的接口 public interface Car { void name(); } 车接口的三个实现类 public class BYD implements Car{ @Override public void name() { Syste 阅读全文
posted @ 2020-05-31 12:04 柏伯伯 阅读(86) 评论(0) 推荐(0)