About Question enthuware.ocpjp.v7.2.1418 :
Posted: Fri Dec 27, 2024 8:17 am
There is an error in the explanation of the following option in this question
in the explanation they say that
Code: Select all
switch(s)
{
case Switch.OFF -> System.out.println("It is off!"); break;
}
witch is wrong for java 21, since Java 21, using <enum name>.<constant>is also valid.1. An enum switch case label must be the unqualified name of an enumeration constant. So it should becase OFF instead of case Switch.OFF.