Header Ads Widget

WAP to implement multiple inheritance in java.

 Code:-

import java.util.*;

class Base
{
public void ff()
{
System.out.println("This is a base class");
}
}

class Derive1 extends Base
{
public void mm()
{
System.out.println("This is derive class1");
}
}
class Derive2 extends Derive1
{
public void mn()
{
System.out.println("This is derive class2");
}
}
class multilevel
{
public static void main(String[] args)
{
Derive2 obj=new Derive2();
obj.ff();
obj.mm();
obj.mn();
}
}

Output:-

This is a base class
This is derive class1
This is derive class2

Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments