Given the directory structure:
Given the definition of the Doc class:
Which two are valid definitions of the WordDoc class? (Choose two.)
Given the directory structure:
Given the definition of the Doc class:
Which two are valid definitions of the WordDoc class? (Choose two.)
The definitions of the `WordDoc` class must follow the rules for sealed classes in Java. Specifically, the `WordDoc` class must be either `final`, `sealed`, or `non-sealed` since it is extending a `sealed` class `Doc`. Furthermore, the package declaration must match the package of the `Doc` class or a permitted package. Therefore, the valid definitions are: 1. `package p1; public final class WordDoc extends Doc {}` - This option is valid because it declares `WordDoc` as `final`, which is allowed for a class extending a `sealed` class. 2. `package p1; public non-sealed class WordDoc extends Doc {}` - This option is valid because it declares `WordDoc` as `non-sealed`, which is also permissible according to the rules for extending sealed classes.
A wrong cuz "package p1.p2" doesnt make sense B correct C wrong cuz no access modifier is more restrictive than public and not allowed. D wrong cuz when using "sealed", one must also use "permits" E wrong cuz missing "sealed", "non-sealed", or "final" F correct.