Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Defining a singleton class
class Singleton {
private static Singleton instance = null;
private Singleton(){}
public static Singleton getInstance(){
if (instance == null) {
instance = new Singleton();
return instance;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment