为什么我的扩展语句不起作用?
由于某种原因,类顶部的 extends
语句在 Eclipse 中产生错误。错误说
“该行有多个标记
导入Employee无法解决
断点:管理器”
错误位于该代码块的第一行:
public class Manager extends Employee
{
private String title;
private double bonus;
public Manager()
{
title = "";
bonus = 0;
}
public Manager(String title, double bonus,
String n, String ssNum, double s, maritalStatus mStatus)
{
super(n, ssNum, s, mStatus);
this.title = title;
this.bonus = bonus;
}
public String toString()
{
return super.toString() + "\nTitle: " + title + "\nBonus ($): " + bonus;
}
}
任何人都可以帮助我吗?
For some reason, the extends
statement at the top of my class produces an error in Eclipse. The error says
"Multiple markers at this line
The import Employee cannot be resolved
Breakpoint:Manager"
The error is on the first line of this block of code:
public class Manager extends Employee
{
private String title;
private double bonus;
public Manager()
{
title = "";
bonus = 0;
}
public Manager(String title, double bonus,
String n, String ssNum, double s, maritalStatus mStatus)
{
super(n, ssNum, s, mStatus);
this.title = title;
this.bonus = bonus;
}
public String toString()
{
return super.toString() + "\nTitle: " + title + "\nBonus ($): " + bonus;
}
}
Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
出现“断点”消息是因为您在该行上定义了断点 - 与此问题无关(右键单击该行左侧边缘的列并取消选中“切换断点”
) ” 可以通过完全删除相关导入行并将鼠标悬停在错误的红色虚线下划线并单击“导入...Employee”快速修复选项来解决。
The "breakpoint" message is there because you have a breakpoint defined on that line - irrelevant to this issue (right-click on the column on the left-hand edge of the line and un-check "Toggle Breakpoint")
The "import Employee" may be solved by deleting the relevant import line entirely and hovering over the dotted red under-line of the error and clicking on the "import ...Employee" quick fix option.
正如我所见,您尝试导入同一包中已有的内容。而且,您使用默认包,不推荐这样做。
尝试将两个类移至另一个包并删除导入。
我希望它有帮助。
As I see it, you try to import something that is already in the same package. Moreover, you use the default package, which is not recomended.
Try moving both of your classes to another package and remove the import.
I hope it helps.