String[][] work = new String[3][];
thats work
work[0] = new String[3];
work[0][0]=" !!! ";
work[0][1]=" !!! ";
work[0][2]=" !!! ";
work[1] = new String[3];
work[1][0]=" !!! ";
work[1][1]=" !!! ";
work[1][2]=" !!! ";
work[2] = new String[3];
work[2][0]=" !!! ";
work[2][1]=" !!! ";
work[2][2]=" !!! ";
thats dont work for me i dont know where is mistake Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 3
那不適合我,我不知道哪里是錯誤線程中的異常“AWT-EventQueue-0”java.lang.ArrayIndexOutOfBoundsException:3
for(int i=0;i<13;i++){
work[i]= new String[3];
}
for(int i=0;i<13;i++){
for(int j=0;j<3;j++){
work[i][j]=" !!! ";
}
}
for(String[] x: work){
for(String e : x){
System.out.println(e);
}System.out.println();
}
mistake is here String[][] work = new String[13][]; 3->13
錯誤在這里String [] [] work = new String [13] []; 3-> 13
1 个解决方案
#1
You should change
你應該改變
for(int i=0;i<13;i++) {
to
for(int i=0;i
This will save you from similar typos.
這樣可以避免類似的拼寫錯誤。