Created
May 13, 2014 03:03
-
-
Save sdecima/9d454ccc70254e7eb2b8 to your computer and use it in GitHub Desktop.
Java (proper) Singleton Class
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 SingletonClass { | |
private SingletonClass() { | |
} | |
private static class SingletonClassHolder { | |
public static final SingletonClass INSTANCE = new SingletonClass(); | |
} | |
public static SingletonClass getInstance() { | |
return SingletonClassHolder.INSTANCE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment