//测试枚举的常用方法
@Test
public void test2(){
System.out.println(Grade.A.name());
System.out.println(Grade.B.ordinal());
String str="D";
Grade g=Grade.valueOf(str);
System.out.println(g);
System.out.println("---------遍历枚举值---------");
Grade gs[]= Grade.values();
for(Grade g1:gs){
System.out.println(g1);
}
}
阅读(856) | 评论(0) | 转发(0) |