What are direct and indirect subclasses?

Given class A:

class B extends A // B is direct subclass of A
class C extends B // C is indirect subclass of A
class D extends C // D is indirect subclass of A

you get the point.


Another way to look at it is using this inheritance chain graph (A is the superclass, the rest inherits):

A->B->C->D

B is a direct subclass of A, the rest are indirect subclass of A.


You are correct. A known direct relationship implies that the class is the immediate ancestor. A known in-direct relationship implies that the class is known to be a sub-class, but it may in fact be many levels below the parent.

Tags:

Java