Transitive Relation?

Exercise Would it be possible to create a chain of inheritance relationships as in the following example?

(a) Yes
(b) No

Solution

Yes! Inheritance is transitive. If GradStudent is a subclass of Student and PhdStudent is a subclass of GradStudent, then PhdStudent is also a subclass of Student.

The chain of inheritance relationships is known as "multilevel inheritance" (where a subclass is inherited from another subclass).

Multilevel inheritance is supported in Java.