nerdexam
Oracle

1Z0-803 · Question #245

1Z0-803 Question #245: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-803 to reveal the answer and full explanation for question #245. The question stem and answer options stay visible for context.

Using Operators and Decision Constructs

Question

Given: public class Test { public static void main(String[] args) { int day = 1; switch (day) { case "7": System.out.print("Uranus"); case "6": System.out.print("Saturn"); case "1": System.out.print("Mercury"); case "2": System.out.print("Venus"); case "3": System.out.print("Earth"); case "4": System.out.print("Mars"); case "5": System.out.print("Jupiter"); } } } Which two modifications, made independently, enable the code to compile and run?

Options

  • AAdding a break statement after each print statement
  • BAdding a default section within the switch code-block
  • CChanging the string literals in each case label to integer
  • DChanging the type of the variable day to String
  • EArranging the case labels in ascending order

Unlock 1Z0-803 to see the answer

You've previewed enough free 1Z0-803 questions. Unlock 1Z0-803 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#switch statement#control flow#type compatibility#break statement
Full 1Z0-803 Practice