目录
枚举类型定义属性
package enumcase;
public enum SeasonEnum {
SPRING("春天"),SUMMER("夏天"),FALL("秋天"),WINTER("冬天");
private final String name;
private SeasonEnum(String name)
{
this.name = name;
}
public String getName() {
return name;
}
}
遍历枚举类型
public enum EnumTest {
MON, TUE, WED, THU, FRI, SAT, SUN;
}
//循环输出值
for (EnumTest e : EnumTest.values()) {
System.out.println(e.toString());
}
TEnum
import org.apache.thrift.TEnum;
public enum AppName implements TEnum {
ZERO(0),
ONE(1);
private final int value;
private AppName(int value) {
this.value = value;
}
public int getValue() {
return this.value;
}
}