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 putdata(int x,int y,int z)
{
len=x;
bre=y;
wid=z;
}
void printdata1()
{
printdata();
System.out.println("Width="+wid);
}
void calarea()
{
int area=len*bre*wid;
System.out.println("Area="+area);
}
}
class
si
{
public static void main(String[]
args)
{
B obj=new B();
obj.putdata(10,20,30);
obj.printdata1();
obj.calarea();
}
}
No comments:
Post a Comment