About Questions enthuware.ocpjp.v17.2.3684, 3685, 3690
Posted: Sat Nov 05, 2022 7:34 am
5th option of enthuware.ocpjp.v17.2.3684 explains:
package days;
sealed class Monday extends WeekDay{ }
A sealed class must have a permits clause.
and 3rd option of enthuware.ocpjp.v17.2.3685 explains:
sealed interface Value extends Cacheable{ }
sealed interface Result extends Cacheable{ }
A sealed interface must have a permits clause.
and 5th option of enthuware.ocpjp.v17.2.3690 explains:
package p1.p2;
public sealed class CompoundIntCalculator extends InterestCalculator{ }
A top level sealed class must have a permits clause.
Also, appropriate import statements are required.
permits clause can be omitted if permitted subclasses/interfaces are declared in the same compilation unit as sealed class/interface.
therefore 3rd option of enthuware.ocpjp.v17.2.3685 and 5th option of enthuware.ocpjp.v17.2.3690 are not incorrect.
package days;
sealed class Monday extends WeekDay{ }
A sealed class must have a permits clause.
and 3rd option of enthuware.ocpjp.v17.2.3685 explains:
sealed interface Value extends Cacheable{ }
sealed interface Result extends Cacheable{ }
A sealed interface must have a permits clause.
and 5th option of enthuware.ocpjp.v17.2.3690 explains:
package p1.p2;
public sealed class CompoundIntCalculator extends InterestCalculator{ }
A top level sealed class must have a permits clause.
Also, appropriate import statements are required.
permits clause can be omitted if permitted subclasses/interfaces are declared in the same compilation unit as sealed class/interface.
therefore 3rd option of enthuware.ocpjp.v17.2.3685 and 5th option of enthuware.ocpjp.v17.2.3690 are not incorrect.