Question: QUESTION 2 (a) The following code includes an annotation @Override. Explain what the annotation does and why it is a good idea. Assume shape has

QUESTION 2 (a) The following code includes an annotation @Override. Explain what the annotation does and why it is a good idea. Assume shape has an implementation of toString(). public class Circle extends Shape { //methods omitted... @Override public String toString() { return super.toString(); } } (5 marks) (b) The code below is an example of dynamic binding. Explain what dynamic binding is using the example below? public class Test{ public static void main(String[] args) { Object o = new Shape(); System.out.print(o.toString()); } } (c) (d) (5 marks) Provide a simple definition of Polymorphism support your answer with a diagram. (3 marks) Write a class Person. The class should have a no argument constructor and private attributes name and phone number. The class should include accessor and mutator methods for each attribute. (7 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
