Which two modifications, made independently, enable the code to compile and run?

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?
A. Adding a break statement after each print statement
B. Adding a default section within the switch code-block
C. Changing the string literals in each case label to integer
D. Changing the type of the variable day to String
E. Arranging the case labels in ascending order

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “Which two modifications, made independently, enable the code to compile and run?

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.