相关代码 |
|
// Employee.java // 抽象类Employee public abstract class Employee { private String firstName; private String lastName; // 构造函数 public Employee( String first, String last ) { firstName = first; lastName = last; } // 返回姓 public String getFirstName() { return firstName; } // 返回名 public String getLastName() { return lastName; } public String toString() { return firstName + ' ' + lastName; } // Employee抽象方法earnings(); //将被其每个子类以实例继承 public abstract double earnings(); }
相关资源 |
|