我在 youtube 上关注 Bucky 的教程系列,但我在让这个特定的教程工作时遇到了一些问题......(http://www.youtube.com/watch?v=hbot9MQVHOM供参考)
package learning;
public class MDArrays {
public static void main (String[] args){
int firstArray[][]={{2,3,4,5,6,7},{1,2,3,4,5,6,7}};
int secondArray[][]={{4,6,2,3},{2,5,1,6,7},{4,3}};
System.out.println("Array #1");
display(firstArray);
System.out.println("Array #2");
display(secondArray);
}
public static void display(int x[][]){
for (int row=0; row<x.length; row++){
for (int column=0; row<x[row].length; column++){
System.out.print(x[row][column] + "\t");
}
System.out.println();
}
}
}
我得到的错误如下
Array #1
2 3 4 5 6 7 Exception in thread "main"
java.lang.ArrayIndexOutOfBoundsException: 6
at learning.MDArrays.display(MDArrays.java:23)
at learning.MDArrays.main(MDArrays.java:11)
如果有人可以帮助我,我将非常感激:)