本帖最后由 樊其杰 于 2013-3-15 16:45 编辑
- public enum TrafficLamp {
- RED {
- public TrafficLamp nextLamp() {
- return GREEN;
- }
- },
- GREEN {
- public TrafficLamp nextLamp() {
- return YELLOW;
- }
- },
- YELLOW {
- public TrafficLamp nextLamp() {
- return RED;
- }
- };
- public abstract TrafficLamp nextLamp();
- }
复制代码 张老师视频中说RED是由TrafficLamp的子类实现是什么意思,哪位帮我分析下这个代码原理? |