调试并实现利用super关键字重写方法。
源文件1: Employee.java
public class Employee {
public String name = "zhangSan";
public double salary = 5000;
public String getDetails() {
return " Name:" + name + "\n" + " Salary:" + salary;
}
}
源文件2: Manager.java
public class Manager extends Employee {
pubilc String department = "Office";
public String getDetails() {
return " Name:" + name + "\n" + " Salary:" + salary + "\n" + " Department: " + department;
}
}
源文件3: TestEx203a.java
public class TestEx203a{
public static void main(String args[ ]) {
Employee e = new Employee();
Manager m = new Manager();
System.out.println("Employee:"+"\n" +e.getDetails());
System.out.println("Manager:"+"\n" +m.getDetails());
}
}
慕容森
白板的微信