java 找不到构造函数_JAVA找不到符号构造函数
JAVA找不到符號構造函數
關注:52??答案:2??mip版
解決時間 2021-02-05 09:13
提問者彼岸獨舞
2021-02-05 00:06
class Rect
{
private double length;
private double width;
public Rect(double length,double width)
{
this.width=width;
this.length=length;
}
public double getLength()
{
return length;
}
public double getWidth()
{
return width;
}
public void setLength(double length)
{
this.length=length;
}
public void setWidth(double width)
{
this.width=width;
}
public double girth(double Girth)
{
Girth=(width+length)*2;
return Girth;
}
public double area(double Area)
{
Area=width*length;
return Area;
}
}
class PlainRect extends Rect
{
private double startX;
private double startY;
public PlainRect(double length,double width,double startX,double startY)
{
setWidth(width);
setLength(length);
this.startX=startX;
this.startY=startY;
}
public PlainRect()
{
setLength(0);
setWidth(0);
startX=0;
startY=0;
}
public boolean isInside(double x,double y)
{
if(x>=startX&&x<=(startX+getLength())&&y>=startY&&y<=(startY+getWidth()))
{
return true;
}
else
return false;
}
}
錯誤:Rect.java:44:cannot resolve symbol
symbol:constructor Rect()
location:class Rect {
^
Rect.java:51:cannot resolve symbol
symbol:constructor Rect()
location:class Rect {
^
2 erroes
最佳答案
二級知識專家柒夏錦年
2021-02-05 00:29
public Rect(){
}
在Rect中添加無參數的構造
全部回答
1樓輓畱嶼赱
2021-02-05 01:36
在父類中,添加無參數的構造。
public rect(){
}
我要舉報
如以上問答內容為低俗/色情/暴力/不良/侵權的信息,可以點下面鏈接進行舉報,我們會做出相應處理,感謝你的支持!
→點此我要舉報以上信息!←
推薦資訊
大家都在看
總結
以上是生活随笔為你收集整理的java 找不到构造函数_JAVA找不到符号构造函数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: cn101388899 一种web服务器
- 下一篇: 群晖挂pt 路由器虚拟服务器设置,群晖挂