这个错误怎样修改

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

2回答
好帮手慕小班 2019-08-18 16:42:10

同学你好,这里可以根据楼上同学的说法来修改一下,如果还是没有解决,还请同学贴出代码,我们来排查一下问题,注意贴在回答中!

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

  • 提问者 慕婉清2006889 #1
    1。Return type for the method is missing 是什么错误 2。eclipse提供2个办法set method return type to "void"和change to constructor 这2个办法是什么意思 package com.imooc.zuoye; public class Developmentwork extends Work { private int line; private int bug; public Developmentwork() {} public DevelopmentWork(String name,int line,int bug) { this.setName(name); this.setLine(line); this.setBug(bug);} public int getLine() { return line; } public void setLine(int line) { this.line = line; } public int getBug() { return bug; } public void setBug(int bug) { this.bug = bug; } public void work() { System.out.println(this.getName()+"的日报是:今天编写了"+this.getLine()+ "行代码,目前仍有"+this.getBug()+"个BUG没有解决"); } }
    2019-08-18 17:50:38
  • 好帮手慕小班 回复 提问者 慕婉清2006889 #2
    同学你好,1、Return type for the method is missing-->方法缺少返回值类型。2、set method return type to "void"是为这个方法添加void的返回值类型,change to constructor-->改变构造函数(方法),这里复制运行贴出代码,同学有参的构造方法没有注意与类名一致,注意是Developmentwork而不是DevelopmentWork,注意最后一个work的w大小写! 以后注意代码不要贴在回复中,会失去代码的格式,要贴在"我要回答"中! 如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
    2019-08-18 18:14:55
BraveSong灬 2019-08-18 16:22:56

带参构造少了一个大括号吧

  • 同学观察的很仔细呐,很棒呐,继续加油! 祝:学习愉快~
    2019-08-18 16:40:34
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师