Multiple inheritance in java

Multiple inheritance in java can be achieved by following ways:

  • A class can implements multiple interfaces.
  • An interface can extends multiple interfaces.


interface DisplayAge{
          void displayAge(int age);
interface DisplayName{
          void displayName(String name);
public class Test implements DisplayAge, DisplayName{
                public void displayAge(int age) {
                        System.out.println("Age = " + age);
                public void name(String name) {
                       System.out.println("Name = " + name); 
                public static void main(String args[]){
                        //object creation
                        Test obj = new Test();
                        //method call


Name = Shivanshu
Age = 27

Java interview questions on Inheritance

Please follow and like us:
Content Protection by