nerdexam
Oracle

1Z0-851 · Question #187

Given: 11. public static void main(String[] args) { 12. Integer i = new Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println("three"); break; 15. default…

The correct answer is A. three. See the full explanation below for the reasoning.

Question

Given: 11. public static void main(String[] args) { 12. Integer i = new Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println("three"); break; 15. default: System.out.println("other"); break; 16. } 17. } What is the result?

Options

  • Athree
  • Bother
  • CAn exception is thrown at runtime.
  • DCompilation fails because of an error on line 12.
  • ECompilation fails because of an error on line 13.
  • FCompilation fails because of an error on line 15.

How the community answered

(43 responses)
  • A
    74% (32)
  • C
    2% (1)
  • D
    7% (3)
  • E
    2% (1)
  • F
    14% (6)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice