Question: In java Pls Fig. 8.8 Employee class with references to other objects. Class Employee Test Class Employee Test (Fig. 8.9) creates two Date objects to

In java Pls Fig. 8.8 Employee class with references to other objects.In java PlsClass Employee Test Class Employee Test (Fig. 8.9) creates two Date objects

Fig. 8.8 Employee class with references to other objects. Class Employee Test Class Employee Test (Fig. 8.9) creates two Date objects to represent an Employee's birthday and hire date, respectively. Line 8 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 10 implicitly invokes the Employee's toString method to display the values of its instance variables and demonstrate that the object was initialized properly. 5 6 7 1 // Fig. 8.9: Employee Test.java 2 1/ Composition demonstration. 3 4 public class Employee Testi public static void main(String[] args) { Date birth = new Date(7, 24, 1949); Date hire = new Date(3, 12, 1988); Employee employee = new Employee ( "Bob", "Bl 10 System.out.println(employee): 11 12 } Date object constructor for date 7/24/1949 Date object constructor for date 3/12/1988 Blue, Bob Hired: 3/12/1988 Birthday: 7/24/1949 L 19. 8.20 (final Instance Variables) In Fig. 8.8 , class Employee's instance variables are never modified after they're initialized. Any such instance variable should be declared final. Modify class Employee accordingly, then compile and run the program again to demonstrate that it produces the same results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!