Question: } Given below are the definition of class Person and Employee. public class Person ( private String name: public Person (String name) { this.name

} Given below are the definition of class Person and Employee. public class Person ( private String name: public Person (String name) { this.name 

} Given below are the definition of class Person and Employee. public class Person ( private String name: public Person (String name) { this.name name; ) ) public String getName () { return name: 1 public class Employee extends Person private int id: } public void display() () public Employee (String n, int i) { super (n); id - 1/ } public void display() ( System.out.println("Name= " +getName()+", ID="id); public void display (char c) ( System.out.println(c+" Name="getName()+" ID="id""+c); Based on the above class definitions, the following variables are declared: Person p: Employee e Answer all of the following questions: a) Write a Java statement that demonstrates the concept of polymorphic reference. (2 marks) b) Write a Java statement that demonstrates the concept of polymorphic behaviour. (2 marks) c) Which method demonstrates the concept of method overriding in the Employee class? (1 mark) d) Which method demonstrates the concept of method overloading in the Employee class? (1 mark) e) Suppose that one of the two classes is to be defined as abstract class. Which class and which method in the class are the most suitable to be defined as abstract? (2 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a An example of polymorphic reference in Java is Person p new EmployeeJohn 1234 Here the reference v... View full answer

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 Programming Questions!