Sunday, 16 June 2013

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();
} }

No comments:

Post a Comment