Skip to content

Instantly share code, notes, and snippets.

@ihcomega56
Created January 7, 2015 18:17
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 ihcomega56/cde2490c3a8d542b6764 to your computer and use it in GitHub Desktop.
Save ihcomega56/cde2490c3a8d542b6764 to your computer and use it in GitHub Desktop.
Enumをさわってみた
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 + "だ!!");
}
}
}
おれはネカマアイドル、しょぼちむだ!!
おれはあざとい男、たろうだ!!
おれはクソリパー、やんくだ!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment