Skip to content

Instantly share code, notes, and snippets.

@sdecima
Created May 13, 2014 03:03
Show Gist options
  • Save sdecima/9d454ccc70254e7eb2b8 to your computer and use it in GitHub Desktop.
Save sdecima/9d454ccc70254e7eb2b8 to your computer and use it in GitHub Desktop.
Java (proper) Singleton Class
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