单例设计模式和多例
作者:互联网
1 public class Car { 2 private static Car car = new Car(); 3 /** 4 * 多例,getInstance()取出里面一个,(jdbc,连接池) 5 private static List<Car> cars = new ArrayList<Car>(); 6 */ 7 private Car() {} 8 public static Car getInstance() { 9 return car; 10 } 11 }
标签:getInstance,多例,Car,private,static,单例,new,设计模式,public 来源: https://www.cnblogs.com/hengzhezou/p/11204279.html