这代码哪里有错误?

public class Work {
	// 属性:工作名
	private String name;
	// 无参构造方法
	public Work(){
		
	}
	//带参构造方法,完成工作类型的赋值
	public Work (String name){
		this.setName(name);
	}
	// 公有的get***/set***方法完成属性封装
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.setName(name);
	}
	
	// 方法: 工作描述,描述内容为:开心工作
	public String work(){
		String str ="开心工作";
		return str;
		
	}
}
public class DevelopmentWork extends Work{
	// 属性: 有效编码行数、目前没有解决的bug个数
	private int line;
	private int bug;
	//编写构造方法,并调用父类相关赋值方法,完成属性赋值
	public DevelopmentWork(){
		
	}
	
	public DevelopmentWork(String name,int line, int bug) {
		super.setName(name);
		this.setLine(line);
		this.setBug(bug);
	}


	// 公有的get***/set***方法完成属性封装
	
	
	public int getLine() {
		return line;
	}
	public void setLine(int line) {
		this.setLine(line);
	}
	public int getBug() {
		return bug;
	}
	public void setBug(int bug) {
		this.setBug(bug);
	}
	
	// 重写运行方法,描述内容为:**的日报是:今天编写了**行代码,目前仍然有**个bug没有解决。其中**的数据由属性提供
	public String work(){
		String str =super.getName()+"的日报是:今天编写了"+this.getLine()+"行代码,目前仍然有"+this.bug+"个bug没有解决。";
		return str;
	}
}
public class TestWork extends Work {
    //属性:编写的测试用例个数、发现的Bug数量
		private int TestLine;
		private int Bugs;
	// 编写构造方法,并调用父类相关赋值方法,完成属性赋值
		public TestWork(){
			
		}
		public TestWork(String name,int TestLine,int Bugs){
			super.setName(name);
			this.setTestLine(TestLine);
			this.setBugs(Bugs);
	}
    // 公有的get***/set***方法完成属性封装
		
		public int getTestLine() {
			return TestLine;
		}
		public void setTestLine(int testLine) {
			this.setTestLine(TestLine);
		}
		public int getBugs() {
			return Bugs;
		}
		public void setBugs(int bugs) {
			this.setBugs(Bugs);
		}
		
	// 重写运行方法,描述内容为:**的日报是:今天编写了**个测试用例,发现了**bug。其中**的数据由属性提供
		public String work(){
			String str = super.getName()+"的日报是:今天编写了"+this.TestLine+"个测试用例,发现了"+this.getBugs()
					+"个bug。";
			return str;
		}
}
public class Test {
    public static void main(String[] args) {
    	System.out.print("父类信息测试:");
    	Work work = new Work();
    	System.out.println(work.work());
    	System.out.print("测试工作类信息测试:");
    	TestWork tw = new TestWork("测试工作", 10, 5);
    	System.out.println(tw.work());
		System.out.print("研发工作类信息测试:");
		DevelopmentWork dw = new DevelopmentWork("研发工作", 1000, 10);
		System.out.println(dw.work());
	}
}


偶然吃到
浏览 1325回答 2
2回答

风吹不止的小海浪

你这和一万行有什么区别啊,,,,, 最起码把报错信息贴出来啊

卧龙绝圣

调试信息呢,你不会想让别人给你调吧
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java