Multilevel inheritance in Java

Learn Multilevel inheritance in java oops with  code example – In Multilevel inheritance, a class is derived from another class which is also derived from some another class … For example class C extends class B and class B extends class A then this type of inheritance in java language is known as multilevel inheritance.

Multilevel inheritance Code Example

 * Multilevel inheritance java program example

 * In this program we basically performing three tier level
 * of inheritance.

//Class GrandFather is the base class or parent class
public class GrandFather {

	void oldage() {

		System.out.println("we are in grandpa class");

// Father class is the child class of class Grandfather
class Father extends GrandFather {

	void Age() {

		System.out.println("we are in father class");

// class Baby is the child class of class Father
class Baby extends Father {

	void newage() {
		System.out.println("we are in baby class");

	public void play() {
		System.out.println("Baby is Playing");

// client class with all the method calls
class TestMultiLevelInheritence {

	// Display method under which different methods are called
	// through the reference of the child class Baby
	public static void Display() {

		// creating object of the class Baby
		Baby b = new Baby();


	// main method with Display Method call...
	public static void main(String[] args) {



we are in grandpa class
we are in father class
we are in baby class
Baby is Playing

Multilevel inheritance in Java

Scroll to top