| public Lamp blackOut() { this.lighted = false;
 if (opposite != null)
 Lamp.valueOf(opposite).blackOut();
 
 Lamp nextLamp = Lamp.valueOf(next);//为啥这里把Lamp nextLamp=null换成了
 //=Lamp.valueOf(next);运行结果就会有问题呢。这里怎么先赋值初始化和先赋值null,然后在代码里再赋具体值差别很大呀!
 if (next != null) {
 System.out.println("绿灯从" + name() + "方向变成----》" + next + "方向");
 //                        nextLamp = Lamp.valueOf(next);
 nextLamp.light();
 }
 return nextLamp;
 }
 
 |