int[][] input = new int[3][];
int count = 1;
for(int i = 0; i <= 2 ; i++ ) {
for(int j = 0; j <= 2; j++) {
input[i][j] = count++;
}
}
第五行抛出错误。
最佳答案
数组的第二个维度为空。
int[][] input = new int[3][];
试试这个:
int[][] input = new int[3][3];
关于java - 为什么下面的java代码会抛出运行时错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21349531/