import java.util.Scanner;
public class TestMultiDimenArray
{
private static int row;
private static int column;
public static int [][] table1 = new int [row][column];
public static int [][] get (int a, int b){
row = a;
column = b;
Scanner keyboard = new Scanner(System.in);
for (int n = 0; n < a; n++){
for (int m = 0; m < b; m++){
table1[n][m] = keyboard.nextInt();
}
}
return table1;
}
public static void display (int [][] array1){
for (int n = 0; n < row; n++){
for (int m = 0; m < column; m++){
System.out.print(table1[n][m] + " ");
}
System.out.println();
}
}
public static void main(String[] args){
get(3,3);
}
}
程序编译成功,但是当我运行它时,它返回错误。我该如何解决它?这就是我所能告诉我的问题。当我能够告诉我的时候,系统有什么问题告诉我要提供更多细节。错误:线程'main'中的异常java.lang.ArrayIndexOutOfBoundsException:0
你尝试调试程序?你认为你正在用'public static int [] [] table1 = new int [row] [column];''做什么?达到此声明时,“row”和“column”的值是什么? Java不是Excel ... – user2336315 2014-10-10 20:26:34