Sunday 27 December 2015

What is Multiple Inheritance in java with it's example

Multiple inheritance in java if a class implements multiple interface or extends multiple interface that's is called multiple interface.




### Example:




/**
 *
 * @author pradeep
 */

interface Multiinterfaceprint
{  
void printmultiinterface();  
}  
  
interface Multiinterfaceshow
{  
void showmultiinterface();  
}  
  
class multiintr implements Multiinterfaceprint,Multiinterfaceshow
{  
  
public void printmultiinterface(){System.out.println("Hello i m interface");
}  
public void showmultiinterface()
{
System.out.println("Welcome to my city");
}  
  
public static void main(String args[])
{  
multiintr obj = new multiintr();  
               obj.printmultiinterface();  
               obj.showmultiinterface();  
 }  



Output Output  of this program is below  


run:

Hello i m interface
Welcome to my city

BUILD SUCCESSFUL (total time: 0 seconds)

No comments:

Post a Comment