Question: public class Person { private String name; public Person (string name) i this.name = name; public string getName () i I return nane; public void

 public class Person \{ private String name; public Person (string name)

i this.name = name; public string getName () i I return nane;

public class Person \{ private String name; public Person (string name) i this.name = name; public string getName () i I return nane; public void display() i ) public class Employee extends Person private int id: public Employee (String n, int i) 1 super (n)/ id=if 1 public void display () ( System. out.println ("Name= "+getName ()+", ID=" + Id); 1 public void display (char c) 1 System.out.println (c+" Name= " +getNane ()+",1D="+id+"+c)z 1 1 Based on the above class definitions, the following variables are declared: Person pi Employee er Answer all of the following questions: a) Write a Java statement that demonstrates the concept of polymorphic referenc (2 mark 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 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!