1 public class Singleton{ 2 3 private Singleton s ; 4 5 private Singleton() {}; 6 7 public static Singleton getInstance{ 8 if(s==null){ 9 10 s = new Singleton(); 11 } 12 return s; 13 } 14 15 } 16 17 public class Singleton { 18 19 private Singleton s = new Singleton(); 20 21 private Singleton(){}; 22 23 public static Singleton getInstance(){ 24 25 return s; 26 } 27 28 }