本帖最后由 王广亚 于 2013-7-23 14:34 编辑
在java中Employee和Pro这两个词是关键字吗?
请看这个(附上代码)- package e1;
- public class AbstractDemo{
- public static void main(String[] args) {
- Manger M=new Manger("经理","1",5000,4000);
- M.work();
- Pro P=new Pro("经理","1",5000);
- P.work();
- }
- }
- abstract class Employee{ //这儿的Employee错误,显示此行的"多个标记"
- // " - 已定义类型 Employee"
- // " - 断点:Employee"
- private String name;
- private String id;
- private double pay;
- Employee(String name,String id,double pay){
- this.name=name;
- this.id=id;
- this.pay=pay;
- }
- public abstract void work();
- }
- class Manger extends Employee{
- private int bonus;
- Manger(String name,String id,double pay,int bonus){
- super(name,id,pay);
- this.bonus=bonus;
- }
- @Override
- public void work() {
- System.out.print("manger work");
- }
- }
- class Pro extends Employee{ /*此行的多个标记
- - 断点:a
- - 已定义类型 Pro
- - 断点:Pro*/
- Pro(String name,String id,double pay){
- super(name,id,pay);
- }
- @Override
- public void work() {
- System.out.print("Pro work");
- }
- }
复制代码 为什么会有这样的错误?
|
|