Answered step by step
Verified Expert Solution
Question
1 Approved Answer
package 1 cs 1 2 5 _ example; public class Employee I / total number of Employee objects created is stoxed in count private static
package csexample;
public class Employee
Itotal number of Employee objects created is stoxed in count
private static int count :
private final String firstName:
private final string lastName;
Inftialize Employee, add to the count and
display the String indicating that constructor was called
public Employee String firstName, String lastName
this.firstName firstName;
this. lastName lastName;
count:
firstName, lastName, count:
s
public String getFirstName
return firstName;
public String getlastName
return lastName;
j
public static int getcount&
return count:
end class Employee
package icsexample:
public class ICSExample
public static void mainStringargs&
System. out.printfEmplovees before instantiation: sdsn
:
Create two employees Bill Frown and Sue Black
Employee bill
Employee sue
System. out.printf snEmployees after instantiation:n:
Display the Employee count
System. out.printf via Employee.getCount : sdsn
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started