刚刚编辑了这个,所以它显示了所有的代码。希望对您有所帮助
我不知道如何为我的程序声明一个主要方法。
这就是我尝试的方法,我得到了大约 45 个错误,主要是非法异常:
public class Rectangle1{
private double width;
private double height;
public Rectangle1(){
}
public Rectangle1(double width, double height){
this.width = width;
this.height = height;
}
public double getWidth(){
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight(){
return height;
}
public void setHeight(double height){
this.height = height;
}
public double getArea(){
return width * height;
}
public double getPerimeter(){
return 2 * (width + height);
}
public static void main (String [] args){
}
}