Get ready for your Object‑Oriented Programming Test. Use flashcards and multiple-choice questions. Each question includes hints and explanations. Prepare for your exam today!

Multiple Choice

What is an indirect superclass?

Inheritance creates a chain of parent classes, where the immediate parent is the direct superclass and every ancestor above it is an indirect superclass. An indirect superclass is any class higher in the hierarchy beyond the direct parent, meaning the grandparents, great-grandparents, and so on. For example, if you have a chain where Child extends Parent and Parent extends Grandparent, then Grandparent is an indirect superclass of Child (while Parent is the direct superclass). This concept helps explain how methods and fields can be inherited along the whole ancestry, not just from the immediate parent. The other ideas don’t fit as well. The class a subclass explicitly inherits from is the direct superclass, not the indirect one. Interfaces are a separate relationship and aren’t classified as indirect superclasses. Being the same as the direct superclass is incorrect because the indirect superclass sits higher in the inheritance chain, not at the immediate level.

Inheritance creates a chain of parent classes, where the immediate parent is the direct superclass and every ancestor above it is an indirect superclass. An indirect superclass is any class higher in the hierarchy beyond the direct parent, meaning the grandparents, great-grandparents, and so on.

For example, if you have a chain where Child extends Parent and Parent extends Grandparent, then Grandparent is an indirect superclass of Child (while Parent is the direct superclass). This concept helps explain how methods and fields can be inherited along the whole ancestry, not just from the immediate parent.

The other ideas don’t fit as well. The class a subclass explicitly inherits from is the direct superclass, not the indirect one. Interfaces are a separate relationship and aren’t classified as indirect superclasses. Being the same as the direct superclass is incorrect because the indirect superclass sits higher in the inheritance chain, not at the immediate level.