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
同学你好,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
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星