剛剛編輯過,所以它顯示了所有的代碼。希望它更有幫助超類/子類程序中的主要方法錯誤
我不知道如何聲明我的程序的主要方法。
這是我嘗試過了,我得到了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){
}
}
究竟是什麼錯誤? – arshajii
這可能是一個愚蠢的問題,但你關閉括號? – Austin
也許是因爲你錯過了一些關閉的剎車片? –