Consider the following method that will alter the matrix mat:
/** @param mat the initialized matrix
* @param row the row number
*/
public static void matStuff(int[][] mat, int row)
{
int numCols = mat[0].length;
for (int col = 0; col < numCols; col++)
mat[row][col] = row;
}
Suppose mat is originally
1 4 9 0
2 7 8 6
5 1 4 3
After the method call matStuff(mat,2), matrix mat will be
(A)
1 4 9 0
2 7 8 6
2 2 2 2
(B)
1 4 9 0
2 2 2 2
5 1 4 3
(C)
2 2 2 2
2 2 2 2
2 2 2 2
(D)
1 4 2 0
2 7 2 6
5 1 2 3
(E)
1 2 9 0
2 2 8 6
5 2 4 3