package StaticImport;
public enum TrafficLamp {
RED(30){
public TrafficLamp nextLamp(){
return GREEN;
}
},
GREEN(30){
public TrafficLamp nextLamp(){
return YELLOW;
}
},
YELLOW(5){
public TrafficLamp nextLamp(){
return RED;
}
};
public abstract TrafficLamp nextLamp();
private int time;//此处一直显示黄色的为什么?说is not used?一直不懂黄色的部分,希望各路神仙来解决。。。
private TrafficLamp(int time){
this.time=time;
}
}
|