Specifications

Sun Services
Java™ Programming Language
Module 6, slide 26 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Overloading Constructors
1 public class Employee {
2 private static final double BASE_SALARY = 15000.00;
3 private String name;
4 private double salary;
5 private Date birthDate;
6
7 public Employee(String name, double salary, Date DoB) {
8 this.name = name;
9 this.salary = salary;
10 this.birthDate = DoB;
11 }
12 public Employee(String name, double salary) {
13 this(name, salary, null);
14 }
15 public Employee(String name, Date DoB) {
16 this(name, BASE_SALARY, DoB);
17 }
18 // more Employee code...
19 }