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


0 Comments