Created
May 24, 2015 14:28
-
-
Save shigemk2/be9aaf2494da390d4abe 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
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