单例模式
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 }
抱怨没有用,只能靠自己