Return to site

JAVA CERTIFICATION QUESTION: Using the arrow in Java’s switch expressions

👉Behavioral differences between statements and expressions can be subtle.

Given the following enum and the main method:

 

Which statement is true? Choose one.

A. The code compiles and prints up.

B. The code compiles and prints up down.

C. The code fails to compile. To fix it you must add the following after line n1:

case HOLD -> System.out.println("hold");

D. The code fails to compile. To fix it you must add the following after line n1:

default -> System.out.println("default");

 

 

 

 

 

·Ɐ sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ