Class EmployeeTest

Class EmployeeTest (Fig. F.9) creates two Date objects (lines 8–9) to represent an Employee’s birthday and hire date, respectively. Line 10 creates an Employee and initializes its instance variables by passing to the constructor two Strings (representing the Employee’s first and last names) and two Date objects (representing the birthday and hire date). Line 12 implicitly invokes the Employee’s toString method to display the values of its instance variables and demonstrate that the object was initialized properly.

 1   // Fig. F.9: EmployeeTest.java 2   // Composition demonstration. 3  4   public class EmployeeTest 5   { 6      public static void main( String[] args ) 7      { 8         Date birth ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.