public enum FtpActionType {
LOGIN(1) {
public String getTitle() {
return "登陆";
}
},
LOGOUT(2) {
public String getTitle() {
return "登出";
}
},
UNKNOWN(99) {
public String getTitle() {
return "未知";
}
};
private int code;
FtpActionType(int code) {
this.code = code;
}
@Override
public String toString() {
return String.valueOf(code);
}
public abstract String getTitle();
}
public enum Difficulty {
// 注意:枚举成员命名,请使用英文大写形式
NORMAL(1), MEDIUM(2), HARD(3);
/**
* final修饰字段是一个良好的实践。
*/
final private int id;
Difficulty(final int id){
this.id=id;
}
/**
* 获得ID
* @return
*/
public int getId() {
return id;
}
}
/**
* 游戏中的难度枚举:NORMAL , MEDIUM, HARD
*
* @author mercyblitz
*/
public enum Difficulty {
NORMAL, MEDIUM, HARD //注意:枚举成员命名,请使用英文大写形式
}