Created
January 7, 2015 18:17
-
-
Save ihcomega56/cde2490c3a8d542b6764 to your computer and use it in GitHub Desktop.
Enumをさわってみた
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
package hetablog; | |
/** | |
* | |
* @author ihcomega | |
*/ | |
public class EnumPractice { | |
private enum Friends { | |
SYOBOCHIM("しょぼちむ") { | |
@Override | |
public String getFeature() { | |
return "ネカマアイドル"; | |
} | |
}, | |
TARO("たろう") { | |
@Override | |
public String getFeature() { | |
return "あざとい男"; | |
} | |
}, | |
YANK("やんく") { | |
@Override | |
public String getFeature() { | |
return "クソリパー"; | |
} | |
},; | |
private final String name; | |
Friends(String name) { | |
this.name = name; | |
} | |
protected abstract String getFeature(); | |
} | |
public static void main(String... args) { | |
for (Friends friend : Friends.values()) { | |
System.out.println("おれは" + friend.getFeature() + "、" + friend.name + "だ!!"); | |
} | |
} | |
} |
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
おれはネカマアイドル、しょぼちむだ!! | |
おれはあざとい男、たろうだ!! | |
おれはクソリパー、やんくだ!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment