Singleton pattern
public class MyClass() {
private static MyClass instance = null;
/**
* Get instance of my class, Singleton
**/
public static MyClass getInstance() {
if(instance == null) {
instance = new MyClass();
}
return instance;
}
/**
* Private constructor
*/
private MyClass() {
//This will only be called once, by calling getInstanse() method.
}
}