【枚举】枚举基础

比较枚举时用==永远不要用equals

 

static  Enum  valueOf(Class enumClass,String name)——返回指定名字,给定类的枚举常量

 

int ordinal()——返回枚举在enum声明的位置,位置从0开始计数

int compareTo(E other)

如果枚举常量出现在other之前,则返回一个负值;

如果this==other,则返回0;否则返回正值

枚举常量的出现次序在enum声明中给出

猜你喜欢

转载自blog.csdn.net/hutuyaoniexi/article/details/81290723