类中有抽象方法的话,这个类肯定是抽象类的,我刚才看了下你说的那个的源码,我见写有absract啊
- abstract class 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 Programmer extends Employee
- {
- Programmer(String name,String id,double pay)
- {
- super(name,id,pay);
- }
- public void work()
- {
- System.out.println("code...");
- }
- }
- //描述经理。
- class Manager extends Employee
- {
- private int bonus;
- Manager(String name,String id,double pay,int bonus)
- {
- super(name,id,pay);
- this.bonus = bonus;
- }
- public void work()
- {
- System.out.println("manage");
- }
- }
复制代码
|