public class Singleton2 {
private Singleton2(){}
private static Singleton2 instance;
public synchronized static Singleton2 getlnstance(){
init();
if(instance==null){
synchronized(Singleton2.class){
if(instance==null)
instance=new Singleton2();
}
return instance;
}
return instance;
}
private static void init(){}
}
|
|