这个错误是什么意思?java.lang.ArrayIndexOutOfBoundsException: -1 ?
java.lang.ArrayIndexOutOfBoundsException: -1
at Game.Game.plantVegetables(Game.java:1160)
at Game.__SHELL11.run(__SHELL11.java:8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at bluej.runtime.ExecServer$3.run(ExecServer.java:725)
异常发生在:
Scanner keyIn = new Scanner (System.in);
for(int leftToPlant=10; leftToPlant>0; leftToPlant--)
if (field[row1][column1].equals("t") ||
field[row1][column1].equals("c") ||
field[row1][column1].equals("p") ||
field[row1][column1].equals("r"))