好吧我一直坚持这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