public enum TrafficLamp//为什么 我这里报错呢,视频里张老师是可以的啊(说是:不能是本地的成员枚举TrafficLamp)
{
RED(4){
public TrafficLamp nextLamp()
{
return GREEN;
}
},
GREEN(6){
public TrafficLamp nextLamp()
{
return YELLOW;
}
},
YELLOW(2)
{
public TrafficLamp nextLamp()
{
return RED;
}
};
public abstract TrafficLamp nextLamp();
private int time;
private TrafficLamp(int time)
{
this.time=time;
}
}
|
|