Multilevel Inheritance
Multilevel Inheritance Multilevel inheritance is a type of inheritance where a class is derived from another class, which in turn is derived from another class. This forms a hierarchy of inheritance where each class inherits properties and behaviors from its superclass. Example: class Animal { void eat() { System.out.println("This animal eats food."); } } class Dog extends Animal { void bark() { System.out.println("The dog barks."); } } class Puppy extends Dog { void weep() { System.out.println("The puppy weeps."); } } public class Main { public static void main(String[] args) { Puppy puppy = new Puppy(); puppy.eat(); puppy.bark(); puppy.weep(); } } Program to Try // Base class class ...