Explain why java does not support multiple inheritance, JAVA Programming

Assignment Help:

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.


Related Discussions:- Explain why java does not support multiple inheritance

Sum of six digits, How do I write a java program that enters a six digit nu...

How do I write a java program that enters a six digit number and takes the sum of the six digits?

Array to store 10messages of type String., Ask1. Storing the Array: Write a...

Ask1. Storing the Array: Write an application that uses an Array to store 10messages of type String. You will store this Array with 10 messages of your choosing. For example, a mes

Exercise\servletexercise, Ask question # Write a servlet to display a table...

Ask question # Write a servlet to display a table that contains factorials for the numbers from 0 to 10,

What are the various struts tag libraries, The Struts tag libraries are: ...

The Struts tag libraries are: ? HTML Tags ? Logic Tags ? Template Tags ? Bean Tags ? Tiles Tags ? Nested Tags

What is jsp page, A JSP page is a text-based document that having two types...

A JSP page is a text-based document that having two types of text: static template data, which can be expressed in any text-based format like HTML, SVG, WML, and XML, and JSP eleme

Java program that reads in a file of products, Write a Java program called ...

Write a Java program called SalesInfoMiner that reads in a file of products, stored in text format (2 lines per entry). The program must then read in information about past sales t

What are the core classes of the struts framework, Struts is a set of coope...

Struts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design. ? JavaBeans components for managing application state and behavior. ? Eve

How dos attack is a cyber crime what cyber crime can be used, How DoS attac...

How DoS attack is a cyber crime? For what cyber crime can be used? DoS stands for Decline of Service and it is a cyber crime as it jams and within a few cases shut down the goa

Explain difference between an if and a switch statement, What is the differ...

What is the difference between an if statement and a switch statement? The if statement is used to select between two alternatives. It uses a boolean expression to decide whi

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd