楼主的第二个for循环多了个分号
for(int column=0;column
public class TestArray {
public static void main(String[] args) {
int[][] matrix = new int[10][10];
for(int row=0;row
for(int column=0;column
}
for(int row=0;row
for(int column=0;column
System.out.println();
}
}
}
运行结果:
60 90 86 96 64 61 64 27 89 61
84 14 40 63 71 16 15 16 79 56
86 27 88 21 98 13 1 4 31 33
45 20 18 58 90 25 96 78 7 65
28 25 67 8 65 87 75 14 82 70
5 11 29 2 36 11 69 2 11 94
95 74 95 69 94 78 27 39 57 79
13 17 72 4 7 92 61 19 23 94
31 87 48 71 23 2 88 14 35 60
63 16 70 88 53 34 72 65 28 94
是二维数组吧。。。真没看出哪错了
兄弟。。。你for循环后边 {前边 加个分号干什么呢。。。
肯定报错啊。。。
你是在获取行数和列数的时候出错了,不能这样写
matrix.length 就是行数
matrix [0].length 就是列数
这个l是L的小写,而这个I是i的大写
你贴图片而不贴代码,就你这个目前的情况而言,就是数组中的column未定义,只有可能说是你的
I l 1 这三个你打错了
如果不是,请补充代码
for (int column = 0; column < matrix[row].length; column++) {
matrix[row][column]=(int)(Math.random()*100);
}
你的括号前面多了分号!!!