我已经尝试了几次,这就是我目前所拥有的:
public void turnOn(int index, spotlights[]){
spotlights[index]=2;
currentStatus=2;
}
这是我的数组定义:
private Spotlight[] spotlights = new Spotlight[20];
有二十盏灯,我将一个(索引)更改为 on 或 currentStatus 更改为 2。
我会很感激任何帮助,谢谢!