Singleton Design Pattern
There must be only one instance of the class.
A class must have single instance.
Simple implementation
The very basic implementation of Singleton Design Pattern should provide
Global point of access
Global method to create the instance
public class Singleton{
public static Singleton INSTANCE;
private Singleton(){
}
public static Singleton getInstance(){
if(INSTANCE == null){
INSTANCE = new Singleton();
}
return INSTANCE;
}
}
Last updated