class
A
{
int len,bre;
void getdata(int x,int y)
{
len=x;
bre=y;
}
void printdata()
{
System.out.println("length="+len);
System.out.println("Breadth="+bre);
}
}
class
B extends A
{
int wid;
void getdata1(int x,int y)
{
getdata(x,y);
}
void calarea()
{
printdata();
int area=len*bre;
System.out.println("Area="+area);
}
}
class
C extends A
{
int wid;
void putdata(int x,int y,int z)
{
len=x;
bre=y;
wid=z;
}
void printdata1()
{
printdata();
System.out.println("Width="+wid);
}
void calarea1()
{
int area=len*bre*wid;
System.out.println("Area="+area);
}
}
class
hi
{
public static void main(String[]
args)
{
B obj=new B();
obj.getdata1(10,20);
obj.calarea();
C obj1=new C();
obj1.putdata(1,2,3);
obj1.printdata1();
obj1.calarea1();
}
}
No comments:
Post a Comment