oop

2. Multilevel Inheritance: Propagation

Analyze the code, write your predicted output, and then reveal the solution.

Scenario

A class inherits from a class, which in turn inherits from another class. This demonstrates how properties and behaviors propagate down the chain.

Code Block
class GrandParent { void legacy() { System.out.println("Old Wisdom"); } } class Parent extends GrandParent { void skill() { System.out.println("Modern Craft"); } } class Child extends Parent { void innovation() { System.out.println("Future Tech"); } } public class Main { public static void main(String[] args) { Child c = new Child(); c.legacy(); // Inherited from GrandParent c.skill(); // Inherited from Parent c.innovation(); // Defined in Child } }
Take Your Shot
Predicted Output

Type exactly what you think will be printed in the console.

2. Multilevel Inheritance: Propagation | DevExCode