Page 1 of 1

About Question enthuware.ocpjp.v7.2.1418 :

Posted: Fri Dec 27, 2024 8:17 am
by mouadA
There is an error in the explanation of the following option in this question

Code: Select all

switch(s)
{
    case Switch.OFF -> System.out.println("It is off!"); break;
}
in the explanation they say that
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.
witch is wrong for java 21, since Java 21, using <enum name>.<constant>is also valid.

Re: About Question enthuware.ocpjp.v7.2.1418 :

Posted: Fri Dec 27, 2024 8:54 am
by admin
You are right. The explanation has now been fixed.
thank you for your feedback!