//PROGRAM TO IMPLMENT SINGLE INHERITANCE
class Room
{
int length,breadth;
Room(int x,int y) //PARMETERIZED CONSTRUCTOR
{
length=x;
breadth=y;
}
int area( )
{
return(length*breadth);
}
}
class diningRoom extends Room
{
int height;
diningRoom(int x,int y,int z) //PARAMETERIZED CONSTRUCTOR
{
super(x,y);
height=z;
}
int volume( )
{
return(length*breadth*height);
}
}
class inheritTest
{
public static void main(String args[ ])
{
diningRoom droom=new diningRoom(14,12,10);
int d_area=droom.area( );
int d_volume=droom.volume( );
System.out.println(“Area of dining room =”+d_area);
System.out.println(“Volume of dining room =”+d_volume);
}
}