title: Define a method for calculating the area of a figure in the Shape class
body: <p>Define a base class that represents shapes: Shape. Define a method for calculating the area of a figure in the Shape class.</p>
  <ol>
  <li>Create a circle class: Circle, Circle inherits the Shape class, and adds a new member attribute, which is a double-precision variable r representing the radius of the circle. Override the method of calculating the area of the parent class, which can calculate and return the area of a circle with a radius of r.</li>
  <li>Create a rectangle class: Rectangle, Rectangle inherits the Shape class, and adds new member attributes, that is, two double-precision variables a and b representing the length and width of the rectangle. Override the method of calculating the area of the parent class, which can calculate and return the area of a rectangle whose length and width are a and b respectively.</li>
  </ol>
  <hr />
  <pre><code>package com.company;
  public class Main {
  
      public static void main(String[] args) {
          interface Shape {
              void calculateArea(double... a);
          }
          class Circle {
              public static void main(String[] args) {
                  Shape shape = (double... a) -&gt;
                          System.out.println(&quot;Area of circle is: &quot; + Math.PI * a[0]);
                  shape.calculateArea(1.55);
              }
          }
          class Rectangle {
              public static void main(String[] args) {
                  Shape shape = (double... a) -&gt;
                          System.out.println(&quot;Area of square is: &quot; + a[0] * a[1]);
                  shape.calculateArea(1.55, 2.55);
              }
          }
          public class Shapes {
          }
      }
  }
  </code></pre>