Question: Instance Variables) In Fig. 8.8 , class Employees instance variables are never modified after theyre initialized. Any such instance variable should be declared final. Modify

Instance Variables) In Fig. 8.8 , class Employees instance variables are never modified after theyre 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.

Here is the code that need to be modified.

public class Employee {

private String firstName; private String lastName; private Date birthDate; private Date hireDate;

public Employee(String firstName, String lastName, Date birthDate, Date hireDate) { this.firstName = firstName; this.lastName = lastName; this.birthDate = birthDate; this.hireDate = hireDate; } public String toString(){ return String.format("%s, %s, Hired: %s Birthday: %s", lastName, firstName, hireDate, birthDate); } }

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!