I have implemented the Singleton class as below:
public class Singleton {
private static Singleton instance = null;
private Singleton() {
}
private synchronized static void createInstance() {
instance = new Singletone();
}
public static Singleton getInstance() {
if(instance == null){
createInstance();
}
return instance;
}
}
But I want to know if it is a correct implementation of a singleton. Are there any problem in multithreaded environment.