Created
September 29, 2019 16:29
-
-
Save IamLizu/11a2715761e6728d8fe4cb69207dc6b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Singleton { | |
// holds created instance of the singleton class | |
private static Singleton Instance = new Singleton(); | |
// private constructor | |
private Singleton () {} | |
public static Singleton getInstance() { | |
// return the created instance on all subsequent calls | |
return Instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment