知识点汇总
枚举类的使用:
类的对象只有有限个,确定的时候称为枚举类。
定义枚举类:
方式一:jdk5.0之前自定义枚举类
方式二:使用enum关键字定义枚举类
Enum中常用的方法:
values()方法,valueOf()方法,toString()方法。
代码示例:
public class EnumTest{
public static void main(String[] args) {
System.out.println(Student.senior);
//toString()
System.out.println(Student.sophomore.toString());
//values()
Season1[] Student= Student.values();
for (int i