About Question enthuware.ocpjp.v21.2.3689 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
steevman
Posts: 1
Joined: Wed Apr 02, 2025 4:49 am
Contact:

About Question enthuware.ocpjp.v21.2.3689 :

Post 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.

admin
Site Admin
Posts: 10461
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.3689 :

Post 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!

nnavlani
Posts: 12
Joined: Sat Aug 02, 2025 11:21 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.3689 :

Post 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.

admin
Site Admin
Posts: 10461
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.3689 :

Post by admin »

Not sure what is your point.

nnavlani
Posts: 12
Joined: Sat Aug 02, 2025 11:21 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.3689 :

Post 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.

admin
Site Admin
Posts: 10461
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.3689 :

Post 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.

vs2013
Posts: 10
Joined: Wed Jul 31, 2013 1:57 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.3689 :

Post by vs2013 »

Hi. I don't have a mention of class B declared as an interface anywhere in the question, the correct answer also assumes B is a class and not an interface, so also not sure where the interface in the explanation comes from:

Image

Code: Select all

//in file B.java
package p2;
public final class B extends p1.A{
}
Any clarification on this will be greatly appreciated. Thank you.
Attachments
Screenshot From 2026-02-21 11-49-36.png
Screenshot From 2026-02-21 11-49-36.png (24.08 KiB) Viewed 10657 times

admin
Site Admin
Posts: 10461
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.3689 :

Post by admin »

The question is about class B and the explanation explains why this option is correct.

The point about interfaces is extra information.

Post Reply