2D Array Traversal Output
What is printed as a result of executing the following code segment?
public class Main {
public static void main(String[] args) {
int[][] matrix = { {1, 2}, {3, 4}, {5, 6} };
for (int i = 0; i < matrix.length; i++) {
System.out.print(matrix[i][0] + " ");
}
}
}
A
2 4 6
B
No output
C
1 3 5
D
1 2 3
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | upadhgau000 | 2 | 2 | 0m 00s | 200 |
| #2 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #3 | y.seong2027 | 0 | 1 | 4m 13s | -263 |
APFIVE