這是我得到指數走出束縛異常的代碼,我不明白爲什麼,ArrayIndexOutOfBound異常
int index = array.length - 1;
E item = array[index];
while (item == null && index >= 0) {
index--;
item = array[index];
}
我得到java.lang.ArrayIndexOutOfBoundsException:在 項目-1 =陣列[指數]; 我不知道我出錯的地方。任何人都可以請幫忙。
把減量陣列的訪問之後。即將'index - '向下移動 –