Saturday 26 December 2015

What is Multiple Inheritance in java with it's example

In this we can have n numbers of parents and a single class which drives from it.



For Example

 class A
   {
       void display()
         {
         
         }
       class B
            {
                   void display()
                          {
           
                           }
                   class C extends A,B
                       {
                             C C1=new C1();
                             C1.disp();
                          }





Another Example:


/**

 *

 * @author pradeep

 */

public class MultipleInheritance {

    

}

interface A

{

   public void MultipleInheritance();

}

interface B

{

   public void MultipleInheritance();

}

class MeltiDemo implements A, B

{

   public void MultipleInheritance()

   {

       System.out.println(" Multiple inheritance");

   }

}


No comments:

Post a Comment