Implements the concept of Multiple inheritance in Java?



class a
{
public int x,y;
public void sum()
{
x=25;
y=20;
int  z=x+y;
System.out.println("sum is="+z);
}}
class b extends a
{
public int g; 
public void mul()
{
g=x*y;
System.out.println("mul is="+g);
}}
class c extends b
{
public void div()
{
int h=10;
int k=(g/h);
System.out.println("Division is="+k);
}}
class multi
{
public static void main(String args[])
{
c obj=new c();
obj.sum();
obj.mul();
obj.div();
} }

Comments

Post a Comment

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart