更新时间:2021-08-29 22:11:40
你的问题就在这里建筑物b = new Building(); //创建对象b
您的构造函数设置为接受两个参数,一个double和一个int,但是你都没有传递。
Your constructor is set up to take two arguments, a double and an int, but you pass neither.
尝试这样的事情删除错误
Try something like this to remove error
double area = 0.0;
int floors = 0;
Building b = new Building(area, floors);
也许更好的想法就是让一个没有参数的构造函数......
Perhaps a better idea would be to just have a constructor that took no parameters...
public Building{
this.area = 0.0;
this.floors = 0;
}
我应用这些更改后,代码会编译并运行...(请参阅下图)
After I apply these changes, the code compiles and runs... (see picture below)