Created
September 9, 2016 03:40
-
-
Save ssisaias/20a6cea207a18659c869b2580a68aacd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ClassicSingleton { | |
private static ClassicSingleton instance = null; | |
protected ClassicSingleton() { | |
// Exists only to defeat instantiation. | |
} | |
public static ClassicSingleton getInstance() { | |
if(instance == null) { | |
instance = new ClassicSingleton(); | |
} | |
return instance; | |
} | |
} | |
//fonte: http://www.javaworld.com/article/2073352/core-java/simply-singleton.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment