如何修改此方法以便使用类Integer
而不是基本类型int
?
int[][] fillMatrix() {
int[][] matrix = new int[5][4];
for (int row = 0; row < 5; row++)
for (int column = 0; column < 4; column++)
matrix[row][column] = row * column;
return matrix;
}
答案 0 :(得分:0)
这个怎么样?
Integer[][] fillMatrix() {
Integer[][] matrix = new Integer[5][4];
for (int row = 0; row < 5; row++)
for (int column = 0; column < 4; column++)
matrix[row][column] = row * column;
return matrix;
}