Specifications

Sun Services
Java™ Programming Language
Module 6, slide 11 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Overriding Methods
1 public class Employee {
2 protected String name;
3 protected double salary;
4 protected Date birthDate;
5
6 public String getDetails() {
7 return “Name: “ + name + “\n” +
8 “Salary: “ + salary;
9}
10 }
1 public class Manager extends Employee {
2 protected String department;
3
4 public String getDetails() {
5 return “Name: “ + name + “\n” +
6 “Salary: “ + salary + "\n" +
7 “Manager of: “ + department;
8}
9}