Single Inheritance Example When a class inherits another class , it is known as a single inheritance. In the example given below, Dog class inherits the Animal class, so there is the single inheritance. File: TestInheritance.java. class Animal{ void eat(){System.out.println(“eating…”);}
Read moreWhat is multilevel inheritance in Java with example?
Multilevel Inheritance occurs when a class extends a class that extends another class . For example, class C extends class B, and class B extends class A. This is referred to as multilevel Inheritance.
Read more