concept manager in category java

This is an excerpt from Manning's book OCA Java SE 8 Programmer I Certification Guide.
Explanation: The rules you need to follow to assign a value to an array element are the same rules you follow when you assign an object to a reference variable. Because the type of array interviewer is Interviewer, you can assign objects of classes that implement this interface. The inheritance of classes Employee, Manager, and HRExecutive and the interface Interviewer are shown in figure A.5.
Figure A.5. UML notation of inheritance hierarchy of the classes Employee, Manager, and HRExecutive and the interface Interviewer
![]()
As you can see in figure A.5, the classes Manager and HRExecutive implement the interface Interviewer. The class Employee doesn’t implement the interface Interviewer; hence, an object of the class Employee can’t be added to an array of type Interviewer.
Imagine the positions Programmer and Manager within an organization. Both of these positions have a common set of properties, including name, address, and phone number. These positions also have different properties. A Programmer may be concerned with a project’s programming languages, whereas a Manager may be concerned with project status reports.
Polymorphism with classes comes into the picture when a class inherits another class and both the base and the derived classes define methods with the same method signature (the same method name and method parameters). As discussed in the previous section, an object can also be referred to using a reference variable of its base class. In this case, depending on the type of the object used to execute a method, the Java runtime executes the method defined in the base or derived class.
Let’s consider polymorphism using the classes Employee, Programmer, and Manager, where the classes Programmer and Manager inherit the class Employee. Figure 6.27 shows a UML diagram depicting the relationships among these classes.
Figure 6.27. Relationships among the classes Employee, Programmer, and Manager
![]()
The class Programmer extends the class Employee, which essentially means that it has access to the method reachOffice defined in Employee. Programmer must also implement the abstract method startProjectWork, inherited from Employee. How do you think a Programmer will typically start work on a programming project? Most probably, the Programmer will define classes and unit test them. This behavior is contained in the definition of the class Programmer, which implements the method start-ProjectWork, as follows:
class Programmer extends Employee { public void startProjectWork() { defineClasses(); unitTestCode(); } private void defineClasses() { System.out.println("define classes"); } private void unitTestCode() { System.out.println("unit test code"); } }We’re fortunate to have another special type of Employee, a Manager, who knows how to start work on a project. How do you think a Manager will typically start work on a programming project? Most probably, the Manager will meet with the customers, define a project schedule, and assign work to the team members. Here’s the definition of the class Manager that extends the class Employee and implements the method startProjectWork: