Created
March 10, 2010 08:09
-
-
Save Mistat/327669 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
| package sample; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| /** | |
| * ■[java] java 修得度問題 (2) | |
| * @see http://d.hatena.ne.jp/Aileron/ | |
| */ | |
| class A | |
| { | |
| static interface AA | |
| { | |
| String value(); | |
| } | |
| enum B implements AA | |
| { | |
| A, | |
| B, | |
| C; | |
| private B() | |
| { | |
| } | |
| private final static String[] map = new String[] { | |
| "hoge", "fuga", "hogehoge" | |
| }; | |
| public String value() { | |
| return map[this.ordinal()]; | |
| } | |
| } | |
| /** | |
| * | |
| * | |
| * @param args | |
| */ | |
| public static void main(final String... args) | |
| { | |
| System.out.println(B.A.value()); | |
| System.out.println(B.B.value()); | |
| System.out.println(B.C.value()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment