23 lines
386 B
Java
23 lines
386 B
Java
|
|
public class Rectangle extends Shape {
|
|
private double width;
|
|
private double height; {
|
|
|
|
}
|
|
|
|
public Rectangle(double width, double height) {
|
|
super("四角形");
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
public double area() {
|
|
return width * height;
|
|
}
|
|
// public void showInfo(){
|
|
// super.showInfo();
|
|
// System.out.println("(半径:" + this.area + ")");
|
|
// }
|
|
|
|
}
|