Oracle
1Z0-851 · Question #50
Given: public static void main(String[] args) { for (int i = 0; i <= 10; i++) { if (i > 6) break; } System.out.println(i); } What is the result?
The correct answer is E. Compilation fails. See the full explanation below for the reasoning.
Question
Given: public static void main(String[] args) { for (int i = 0; i <= 10; i++) { if (i > 6) break; } System.out.println(i); } What is the result?
Options
- A6
- B7
- C10
- D11
- ECompilation fails.
- FAn exception is thrown at runtime.
How the community answered
(42 responses)- A14% (6)
- B2% (1)
- C5% (2)
- E76% (32)
- F2% (1)
Community Discussion
No community discussion yet for this question.