1 public class Singleton { 2 3 private static Singleton singleton ; 4 5 private Singleton(){} 6 7 public static Singleton getInstance(){ 8 9 if(singleton == null){ 10 11 singleton = new Singleton(); 12 13 } 14 return singleton; 15 } 16 }
原文:http://www.cnblogs.com/mybatis/p/5896165.html