Specifications

Sun Services
Java™ Programming Language
Module 6, slide 14 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Invoking Overridden Methods
1 public class Employee {
2 private String name;
3 private double salary;
4 private Date birthDate;
5
6 public String getDetails() {
7 return "Name: " + name + "\nSalary: " + salary;
8}
9}
1 public class Manager extends Employee {
2 private String department;
3
4 public String getDetails() {
5 // call parent method
6 return super.getDetails()
7 + “\nDepartment: " + department;
8}
9}