199.下面的类表示一个矩形,请找出源代码中的错误并改正。
public class Rectangle {
private int width;
private int height;
public Rectangle() {
super(1, 1);
}
public Rectangle(int width, int height) {
this.width = width;
this.height = height;
}
public void getHeight() {
return height;
}
public void setHeight(int height) {
height = height;
}
public void getWidth() {
return width;
}
public void setWidth(int width) {
width = width;
}
public int getArea() {
this.width * this.height;
}
public double getPerimeter() {
2 * (this.width + this.height);
}
} |
|