QuestionQ56

Java Object-Oriented Approach

Given the definition of the Doc class:

Question Image

Which statement is correct?

  • A The WordDoc class should exist within p1 of module1.
  • B The Doc class must declare non-abstract.
  • C The WordDoc class could exist within another package, p2, of module1.
  • D The getName() method should be abstract.
Explanation

A permitted direct subclass of a sealed class may be declared in a different package when both classes are in the same named module. Thus, WordDoc can be in package p2 of module1. A sealed class may also be abstract, and getName() may remain a concrete method.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!