You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
371 B

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;
}
}