enum的高级应用

来源:互联网 发布:淘宝联盟没有代购推广 编辑:程序博客网 时间:2024/05/16 13:39
public enum Lamp{
RED(30){
public  Lamp nextLamp(){
return GREEN;
}
},
GREEN(45){
public  Lamp nextLamp(){
return YELLOW;
}
},
YELLOW(5){
public  Lamp nextLamp(){
return RED;
}
};
public abstract Lamp nextLamp();
private int time;
private Lamp (int time){this.time = time;}
}
0 0