Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions