| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice Test
Share
easy Solved by 8 students
2D Array Traversal Output
< Prev
Next >

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

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki11 0m 00s 100
#2y.seong202711 0m 29s 71
#3bommasam00011 4m 32s -172
APFIVE © 2020.
Email: [email protected]|Privacy Policy