//Hierarchical Inheritance
class Shape
{
float length,breadth,radius;
}
class Rect extends Shape
{
 Rect(float l,float b)
 {
  length=l;
  breadth=b;
 }
 float rectangleArea()
 {
 return length*breadth;
 }
}
class Circle extends Shape
{
 Circle(float r)
 {
  radius=r;
 }
 float circleArea()
 {
 return 3.14*(radius*radius);
 }
}
class Hierarchical
{
public static void main(String args[])
{
 Rect o1=new Rect(2,5);
 System.out.println(“Area of Rectangle=” +o1.rectangleArea());
 Circle o2=new Circle(5);
 System.out.println(“Area of Circle=” +o2.circleArea());
}
}