java program 4
itprofessionalsrocks.blogspot.com
java program 4:
a simple program demonstrating use of super .
class rectangle
{
float height;
float breadth;
rectangle(float h,float b)
{
height=h;
breadth=b;
}
double area()
{return height*breadth;
}
class rectweight extends rectangle
{
float weight;
rectweight(float h,float b,float w)
{
super(h,b);
weight=w;
}
}
class super1
{
public static void main(String args[])
{
rectweight obj=new rectweight(10,20,50);
double are;
are=obj.area();
System.out.println("area is"+are);
}
}
Comments
Post a Comment