java 找不到构造函数_JAVA找不到符号构造函数

JAVA找不到符号构造函数

关注:52  答案:2  mip版

解决时间 2021-02-05 09:13

e6cb1a03ad541b3098697807b7bf1798.png

提问者彼岸独舞

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

最佳答案

e6cb1a03ad541b3098697807b7bf1798.png

二级知识专家柒夏锦年

2021-02-05 00:29

public Rect(){

}

在Rect中添加无参数的构造

全部回答

e6cb1a03ad541b3098697807b7bf1798.png

1楼輓畱嶼赱

2021-02-05 01:36

在父类中,添加无参数的构造。

public rect(){

}

我要举报

如以上问答内容为低俗/色情/暴力/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!

→点此我要举报以上信息!←

推荐资讯

大家都在看

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值