Given:
and the code fragment:
Which three code fragments, at line n1, prints SPRING? (Choose three.)
Given:
and the code fragment:
Which three code fragments, at line n1, prints SPRING? (Choose three.)
To print the enum constant SPRING, we need statements that properly reference this constant. The statement `System.out.println(Season.SPRING);` directly prints the SPRING constant. Using `System.out.println(Season.valueOf("SPRING"));` also prints SPRING as it retrieves the enum constant with the specified name. Lastly, `System.out.println(sA[1]);` works because the `values()` method returns the array of enum constants in the order they are declared, so accessing the element at index 1 gives us SPRING. Options involving invalid method calls or incorrect data types will either result in errors or not output the expected value.
CDG System.out.println(Season.SPRING); System.out.println(Season.valueOf("SPRING")); System.out.println(sA[1]);
A prints 1 B produces an error : method values in enum Question17 cannot be applied to given types; E produces an error : no suitable method found for valueOf(char) F prints Winter
C, D, G is the correct answer. System.out.println(sA[1]); System.out.println(Season.valueOf("SPRING")); System.out.println(Season.SPRING);
cardinal will not print String, valueOf(c) will produce exception.
values metod, not aceptt parameters , B is incorrect, C D AND G CORRECT
C,D AND E. is correct
ANSWER IS C,D & G
Answer is CDG