第一种使用方式
开发过程中经常使用Enum,比如:
public enum AppType {
Story,
Songs,
}
常用有以下三个常用方法:
ordinal() //序列号值, 如:index == AppType.Story.value()
name() //名称,如:Story、Songs
values() //返回一个数组, 取index所在的Enum值,如:AppType.values()[index];
第二种使用方式
private enum AppType {
Story(0),
KidSongs(1);
private int value;
private AppType(int value) {
this.value = value;
}
}