Question: Base on the code below: 12. TRUE OR FALSE: In the example above, Manager is the superclass, while class Employee is the subclass. 13. TRUE

Base on the code below:

12. TRUE OR FALSE: In the example above, Manager is the superclass, while class Employee is the subclass.

13. TRUE OR FALSE: A programmer may call the getEmployees() method directly from the variable b in the main method in the EmployeeDemo class.

public class Employee {

private String firstName;

private String lastName;

public Employee(String first, String last) {

firstName = first;

lastName = last;

}

}

public class Manager extends Employee {

private ArrayList employees;

public Manager(String first, String last, ArrayList emps) {

super(first, last);

employees = emps;

}

public ArrayList getEmployees() { return employees;

}

}

public class EmployeeDemo {

public static void main(String[] args) {

Employee a = new Employee("Alice", "Anderson");

ArrayList emps = new ArrayList<>();

emps.add(a);

Employee b = new Manager("Bob", "Barclay", emps);

}

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!