- public enum TrafficLamp
- {
- RED(30) {
- @Override
- public TrafficLamp nextLamp() {
- // TODO Auto-generated method stub
- return GREEN;
- }
- },GREEN(45) {
- @Override
- public TrafficLamp nextLamp() {
- // TODO Auto-generated method stub
- return YELLOW;
- }
- },YELLOW(5) {
- @Override
- public TrafficLamp nextLamp() {
- // TODO Auto-generated method stub
- return RED;
- }
- };
- public abstract TrafficLamp nextLamp();
- private int time;
- private TrafficLamp(int time)
- {
- this.time=time;
- }
- }
复制代码 求详细解释下... |
|