Populating a 2D Array with Nested Loops
Consider the following code segment:
int[][] data = new int[3][3];
for (int m = 0; m < data.length; m++)
{
for (int n = 0; n < data[0].length; n++)
{
data[m][n] = m * n;
}
}
What are the contents of data after the code segment has executed?
A
1 1 1
2 2 2
3 3 3
B
0 1 2
0 2 4
0 3 6
C
0 0 0
0 1 2
0 2 4
D
1 2 3
2 4 6
3 6 9
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE