好吧我一直堅持這10個錯誤,有人可以幫助我嗎?這些錯誤是關於標識符和東西的問題。我堅持了這一段時間,只是不知道我錯了哪裏?我沒有正確設置變量或什麼?這個錯誤:我應該如何解決這個問題
DemoSquare.java:36:錯誤:預期 公共廣場(高度,寬度) ^
DemoSquare.java:36:錯誤:預期 公共廣場(高度,寬度) ^
DemoSquare.java:36:error:';'預期 公共廣場(高度,寬度) ^
DemoSquare.java:39:錯誤:預期 square_width =寬度; ^
DemoSquare.java:42:錯誤:類,接口,或枚舉預期 公衆詮釋的getHeight() ^
DemoSquare.java:47:錯誤:類,接口,或枚舉預期 } ^
DemoSquare.java:48:錯誤:類,接口,或枚舉預期 公衆詮釋的getWidth(){ ^
DemoSquare.java:50:錯誤:類,INTE rface,或枚舉預期 } ^
DemoSquare.java:51:錯誤:類,接口,或枚舉預期 公衆詮釋computeSurfaceArea() ^
DemoSquare.java:54:錯誤:類,接口或枚舉預期 surfaceArea =(getheight()* getwidth()); ^
DemoSquare.java:55:error:class,interface,or enum expected return surfaceArea; ^
DemoSquare.java:57:錯誤:類,接口,或枚舉預期 } ^ 12錯誤
工具退出碼1
`import java.util.Scanner;
public class DemoSquare
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
//Prints asking for Square user input
System.out.println("Please enter square height: ");
int square_height = input.nextInt();
System.out.println("Please enter square width: ");
int square_width = input.nextInt();
//Prints asking for Cube user input
System.out.println("Please enter cube height: ");
int cube_height = input.nextInt();
System.out.println("Please enter cube width: ");
int cube_width = input.nextInt();
System.out.println("Please enter cube depth: ");
int cube_depth = input.nextInt();
//Prints for Square Area :)
Square aSquare = new Square(square_height, square_width);
System.out.println("Square Area is: "+ square.computeSurfaceArea());
Cube aCube = new Cube(cube_height, cube_width, cube_depth);
System.out.println("Cube Area is: " + cube.computeSurfaceArea());
}
}
public class Square
{
int square_height = 0;
int square_width = 0;
public Square(height, width) (
square_height= height;
square_width= width;
}
public int getheight()
{
return square_height;
}
public int getwidth(){
return square_width;
}
public int computeSurfaceArea()
{
int surfaceArea = square_height * square_width;
surfaceArea = (getheight() * getwidth());
return surfaceArea;
}
}
public class Cube extends Square
{
int cube_height = 0;
int cube_width = 0;
int cube_depth = 0;
public Cube(int height, int width, int depth) {
super(cube_height, cube_width);
cube_depth = depth;
}
@Override
public int getcube_width() {
return cube_width;
}
@Override
public int getcube_height() {
return cube_Height;
}
public int getcube_depth() {
return cube_depth;
}
@Override
public int computeSurfaceArea() {
int cube_surface_area = (cube_height * cube_width * cube_depth);
return cube_surface_area;
}
}`
在這裏,他們是:1。更具體2.更具體3.更具體4.更具體5。更具體6.更具體7.更具體8.更具體9.更具體10.更具體 – awksp
我投票結束。閱讀幫助中心。 –
請記住,Java是區分大小寫的。 – Christian