Created
April 11, 2012 03:55
-
-
Save notyy/2356738 to your computer and use it in GitHub Desktop.
java enum
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
public enum Orientation { | |
East("E"), South("S"), West("W"), North("N"); | |
private final String id; | |
private Orientation(String id) { | |
this.id = id; | |
} | |
public String getId() { | |
return id; | |
} | |
} | |
我想从Orientation.East里可以取得缩写"E",也可以通过"E"获取East |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment