定义一个枚举类 //枚举类型 public enum test122 { RED , GREEN , BLUE ; } 测试类public class test123 { public static void main ( String [] args ){ System . out . println ( test122 . BLUE ); test122 [] sigs = test122 . values ();
//枚举类型
public enum test122 {
RED,
GREEN,
BLUE;
}
测试类public class test123 {
public static void main(String[] args){
System.out.println( test122.BLUE );
test122[] sigs=test122.values();
for(test122 e:sigs){
System.out.println( "枚举名称" +e.name());
System.out.println( "枚举的索引" +e.ordinal());
}
}
}