老师这个报错怎么回事
来源:4-4 编程练习
散落满天的回忆
2019-07-27 15:00:59
public abstract class Shape{
public abstract float area();
}
public class Rectangle extends Shape {
//属性:矩形的长lenghth、宽wide
private float lenghth;
private float wide;
//创建带参构造方法以及无参构造方法
public Rectangle(){
}
public Rectangle(float length,float wide){
}
//创建针对长、宽的赋值和取值方法
public float getLenghth(){
return this.lenghth;
}
public void setLenghth(float lenghth){
this.lenghth=lenghth;
}
public float getWide(){
return this.wide;
}
public void setWide(){
this.wide=wide;
}
//重写父类的area()方法
@Override
public float area() {
float area=this.getLenghth()*this.getWide();
return area;
}
Multiple markers at this line
- The method area() of type Rectangle must override or implement a supertype
method
- implements com.imooc.test.Shape.area1回答
好帮手慕小班
2019-07-27
同学你好,这里只是复制贴出代码,并没有问题,请同学贴出完整的代码,和报错截图!
这里有一个问题,有参的构造方法要将传入的参数,赋值给这个属性

注意setWide方法中是有参数的!其余代码还请同学贴全!
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
相似问题