public class Singleton {
private static Singleton singleton ;
private static Singleton getInstance(){
if(singleton==null){
synchronized (singleton) {
if(singleton==null){
singleton = new Singleton();
}
}
}
return singleton;
}
}
private static Singleton singleton ;
private static Singleton getInstance(){
if(singleton==null){
synchronized (singleton) {
if(singleton==null){
singleton = new Singleton();
}
}
}
return singleton;
}
}