questiona differentiate between the following


Question:

(a) Differentiate between the following terms using suitable examples of your own:-

(i) inheritance v/s composition
(ii) subclass v/s superclass
(iii) software re-usability v/s data encapsulation

(b) Discuss why casting a superclass reference to a subclass reference is potentially dangerous. Use appropriate examples to support your answer.

(c) (i) Explain why Java does not support multiple inheritance.

(ii) What feature of Java helps to simulate multiple inheritance. Use a suitable example of your own to illustrate your answer.

(d) (i) Write down an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle, Square. Use Quadrilateral as the
superclass of the hierarchy.

(ii) Identify a maximum number of subclass levels in your hierarchy.
(iii) The private data members of Quadrilateral should include the (x,y) coordinate pairs for the four endpoints of the Quadrilateral.

(iv) Write down a driver program that instantiates and displays objects of each of these classes.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: questiona differentiate between the following
Reference No:- TGS0373934

Expected delivery within 24 Hours