public class Rectangle extends Shape { // 私有属性:长、宽 private double length; private double width; // 构造方法 public Rectangle(double length, double width) { this.length = length; this.width = width; } // 重写父类方法 @Override public double getArea() { return length * width; } }