2D Array Traversal Output
What will be printed when the above program is executed?
public class Main {
public static void main(String[] args) {
int[][] array = { {1, 2, 3}, {4, 5, 6} };
for (int[] row : array) {
for (int num : row) {
System.out.print(num + " ");
}
}
System.out.println();
}
}
A
Compilation Error
B
1 2 3 4 5 6
C
1 2 3
D
4 5 6
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #2 | y.seong2027 | 1 | 1 | 0m 29s | 71 |
| #3 | bommasam000 | 1 | 1 | 4m 32s | -172 |
APFIVE