-1
我正在一個Java應用程序中工作,我不斷收到標題中的錯誤,我不知道爲什麼。在線程「AWT-EventQueue-0」中獲取異常java.lang.ArrayIndexOutOfBoundsException:2
這裏IR我的代碼:
public static Object[] DataProcessinglcld(String in, String par){
Object[] ret = new Object[2];
if (in.contains("string" + par)){
ret[0] = par;
ret[1] = 0;
return ret;
}
else{
ret[0] = in;
ret[1] = 1;
return ret;
}
}
...
Object[] xlib = DataProcessinglcld(in[bit], "xlib.v"); // error line
//System.arraycopy(DataProcessinglcld(in[bit], "xlib.v"), 0, xlib, 0, 2);
bit++;
ret[4] = xlib[0];
ret[5] = xlib[1];
if ((int) xlib[1] == 1) {
return FillWithZ(6,ret);
}
據我所知,所提到的錯誤與試圖進入電影數組的索引錯誤,但據我瞭解我正嘗試將長度爲2的數組分配給另一個長度相同的數組。 請注意,如果我只是將DataProcessinglcld([位],「xlib.v」)中的結果複製到使用問題行下方註釋中的函數的數組中,則會得到相同的錯誤。
什麼'bit'在'在[位]'? – khelwood