Page 1 of 1
About Question enthuware.ocpjp.v21.2.3689 :
Posted: Fri Apr 04, 2025 12:55 am
by steevman
The question here states "Identify correct statements.".
The option "Class B will compile if, instead of final, it is made non-sealed." is considered wrong, with the explanation:
"A permitted subclass of a sealed class must be final, non-sealed, or sealed. So, final is fine for class B."
While final is perfectly fine, so is "non sealed", which makes "Class B will compile if, instead of final, it is made non-sealed." true.
Re: About Question enthuware.ocpjp.v21.2.3689 :
Posted: Fri Apr 04, 2025 3:51 am
by admin
Actually the option is trying to imply that final has to be removed and then made non-sealed. But you are right, it is not written correctly to imply the same unambiguously.
Fixed.
thank you for your feedback!
Re: About Question enthuware.ocpjp.v21.2.3689 :
Posted: Mon Oct 13, 2025 10:05 am
by nnavlani
In your explanation, "A permitted subclass of a sealed class must be final, non-sealed, or sealed. So, final is fine for class B.
Remember that since interfaces cannot be final, a permitted subinterface of a sealed interface must be either sealed or non-sealed." In the question, it's a Class and NOT an interface. And so Class B can or cannot be extended and so there should be no need to change final to non-sealed.
Re: About Question enthuware.ocpjp.v21.2.3689 :
Posted: Mon Oct 13, 2025 3:49 pm
by admin
Not sure what is your point.
Re: About Question enthuware.ocpjp.v21.2.3689 :
Posted: Thu Oct 30, 2025 5:39 pm
by nnavlani
My Point is that the answer explains that A and B are Interfaces, whereas in the question, both A and B are Classes and NOT interfaces. So while the explanation may be good and works for interfaces, the question is asked for A and B as classes only.
Re: About Question enthuware.ocpjp.v21.2.3689 :
Posted: Thu Oct 30, 2025 8:01 pm
by admin
The first line of the explanation is for classes. It completes the reasoning for the given situation.
The second line gives extra information relevant for interfaces. It is not for this particular code but provides extra info if the given code had interfaces inste of classes.