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.
About Question enthuware.ocpjp.v21.2.3689 :
Moderator: admin
-
- Posts: 1
- Joined: Wed Apr 02, 2025 4:49 am
- Contact:
-
- Site Admin
- Posts: 10436
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v21.2.3689 :
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!
Fixed.
thank you for your feedback!
-
- Posts: 8
- Joined: Sat Aug 02, 2025 11:21 pm
- Contact:
Re: About Question enthuware.ocpjp.v21.2.3689 :
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.
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.
-
- Site Admin
- Posts: 10436
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v21.2.3689 :
Not sure what is your point.
Who is online
Users browsing this forum: No registered users and 77 guests