About Question enthuware.ocpjp.v17.2.3683 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
elotmanik
Posts: 1
Joined: Sat Jul 16, 2022 1:28 pm
Contact:

About Question enthuware.ocpjp.v17.2.3683 :

Post by elotmanik »

I think the response is not fully correct, some options are though correct. example Option1 is correct, you can declare a sealed class without permits if classes which extend it are in the same java file as the sealed class

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

Re: About Question enthuware.ocpjp.v17.2.3683 :

Post by admin »

You are right. This has now been fixed and an explanation has been added..
thank you for your feedback!

ftejada
Posts: 8
Joined: Mon Jan 28, 2019 2:00 pm
Contact:

Re: About Question enthuware.ocpjp.v17.2.3683 :

Post by ftejada »

I think we could apply the same assumption to Option 2. Meaning that it could be a valid sealed class declaration too if a subclass were defined in the same Java file.

I guess the question "Identity potentially valid declarations of sealed classes", especially the word "potentially" can lead to different interpretations.

Thanks.
Last edited by ftejada on Wed Jul 20, 2022 1:03 pm, edited 1 time in total.

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

Re: About Question enthuware.ocpjp.v17.2.3683 :

Post by admin »

Very true indeed!
Updated again.

Val Martinez
Posts: 11
Joined: Thu Sep 01, 2022 10:58 am
Contact:

Re: About Question enthuware.ocpjp.v17.2.3683 :

Post by Val Martinez »

I cannot assume option 2,

"public sealed class DocType { }"

as a valid option.

Permits clause is required. Otherwise, it does not compile.

Please, fix it. Thank you.

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

Re: About Question enthuware.ocpjp.v17.2.3683 :

Post by admin »

permits is not required if the permitted class is in the same file.

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests