Multiple Inheritance



Write a program in Java to multiple Inheritance and call all the
show() function from the subclass.





Program:


class A


 {


     A()


    {


     System.out.println("Hello A");


    }


 }


class B
extends A


 {  


  B()


    {


super();


     System.out.println("Hello B" );


    }


}


class C
extends B


 {


  C()


    {


      super();


     System.out.println("Hello C" );


    }   


}


class
Sk18


 {


 


  public static void main(String args[])


    {


    C obj=new C();


    }


 }


Compile:


D:\>javac
Sk18.java


Run:


D:\>java
Sk18


Output:


Hello A


Hello B




Hello C


Comments

Popular posts from this blog

Write a Program to Add two 3x3 Matrix using C

C program for Unit Conversion

Write a Program to Add two 5x5 Matrix using C