Created
November 9, 2013 19:39
-
-
Save adewale/7388992 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 SingletonExample { | |
private static SingletonExample instance = new SingletonExample(); | |
public static SingletonExample getInstance() { | |
return instance; | |
} | |
private SingletonExample() { | |
//Make sure they can't create another instance | |
} | |
public void doSomething() { | |
//Whatever this thing actually is supposed to do | |
System.out.println("Ceci n'est pas une Singleton"); | |
} | |
public static void main(String[] args){ | |
SingletonExample.getInstance().doSomething(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment