Skip to content

Instantly share code, notes, and snippets.

@anjanashankar9
Last active November 22, 2020 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anjanashankar9/48ee247116e1c692b7b9376fb558b1be to your computer and use it in GitHub Desktop.
Save anjanashankar9/48ee247116e1c692b7b9376fb558b1be to your computer and use it in GitHub Desktop.
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