Page 1 of 1

About Question enthuware.ocpjp.v17.2.3688

Posted: Sun Apr 21, 2024 10:40 pm
by samsonwilliams
Why the option "Making the Book class extend Document will eliminate all compilation errors." is correct?

1 - "sealed class Document implements Readable permits Book{ " there is no problem here, the trouble come from "non-sealed class Book implements Readable { }" because this last one "no extends the sealed class THAT permits it.

Am I wrong?

Re: About Question enthuware.ocpjp.v17.2.3688

Posted: Sun Apr 21, 2024 10:54 pm
by admin
>Why the option "Making the Book class extend Document will eliminate all compilation errors." is correct?
Because it does fix the compilation errors in the code as given. Did you try it?


>1 - "sealed class Document implements Readable permits Book{ " there is no problem here, the trouble come from "non-sealed class Book implements Readable { }" because this last one "no extends the sealed class THAT permits it.

Correct. That is why the option is asking you to make the Book class extend Document. i.e.:

non-sealed class Book extends Document implements Readable{ }