Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created May 24, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/be9aaf2494da390d4abe to your computer and use it in GitHub Desktop.
Save shigemk2/be9aaf2494da390d4abe to your computer and use it in GitHub Desktop.
class Test {
public static void main(String[] args) {
Single.instance.hoge();
// Single s = new Single();
Single s = Single.instance;
s.hoge();
}
}
class Single {
public final static Single instance = new Single();
private Single() {}
public void hoge() { System.out.println("hoge"); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment