枚举定义三个常量--遍历如下
package t02;
public enum Season {
//枚举定义三个常量
SUN, MOON, EARTH
}
--------------------
package t02;
public class Test01 {
public static void main(String[] args) {
// 定义一个数组
Season[] values = Season.values();
System.out.println(values);
// 遍历for里面的数组
for (Season sea : values) {
System.out.println(sea);
}
}
}
-----