public enum Tra{
RED(3){
public Tra nextLamp(){return GREEN;}
},
GREEN(4){
public Tra nextLamp(){return YELLOW;}
},
YELLOW(5){
public Tra nextLamp(){return RED;}
};
public abstract Tra nextLamp();//抽象方法
private int time;
private Tra(int time){this,time=time;}//带参数的构造函数
}
这个枚举类 定义了三个Tta类型的属性 RED,GREEN,YELLOW,后面大括号里的抽象方法应该怎么理解?
|