Java中二维数组赋值的方式有以下几种:
int[][] array = new int[3][3];
array[0][0] = 1;
array[0][1] = 2;
array[0][2] = 3;
// ...
int[][] array = new int[3][3];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
array[i][j] = i + j;
}
}
int[][] array = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
int[][] array = new int[3][];
array[0] = new int[]{1, 2, 3};
array[1] = new int[]{4, 5, 6};
array[2] = new int[]{7, 8, 9};