Singleton design pattern and cases of

. 1  public  class Car {
 2      Private  static Car CAR = new new Car ();
 . 3      / ** 
. 4       * Multi cases, getInstance () remove the inside of a, (jdbc, connection pool)
 . 5          Private static List <Car> = new new cars the ArrayList < Car> ();
 . 6       * / 
. 7      Private CAR () {}
 . 8      public  static CAR the getInstance () {
 . 9          return CAR;
 10      }
 . 11 }

 

Guess you like

Origin www.cnblogs.com/hengzhezou/p/11204279.html