nerdexam
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)
  • A
    14% (6)
  • B
    2% (1)
  • C
    5% (2)
  • E
    76% (32)
  • F
    2% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice