hi friends
java does not support multilevel inheritance.
what is the reason behind this??
is this for security reason??

Here are 3 great links that should answer your question:

Some of the reasons being:

1) Multiple inheritances does complicate the design and creates problem during casting, constructor chaining etc thus the reasons for omitting multiple inheritance from the Java language mostly stems from the "simple, object oriented, and familiar" goal.

2) Ambiguity around Diamond problem

Java solution:

Instead, Java's designers chose to allow multiple interface inheritance through the use of interfaces, an idea borrowed from Objective C's protocols. Multiple interface inheritance allows an object to inherit many different method signatures with the caveat that the inheriting object must implement those inherited methods.

It is also interesting to note C# also doesnt allow for multiple inheritance of classes and rather multiple interface inheritance.

I guess this is also the reason why Java best practice it to make every class implement an interface, thus you can implement your multiple classes by implementing their interfaces on the new class.

but don't forget, by implementing interfaces you don't really inherit anything, so Java doesn't allow multiple (interface) inheritance through interfaces, it simply allows you to simulate multiple inheritance.

commented: thank you for exactness +0

I was really tempted to delete this and another post given the content and user signatures. SEO is always risky poster

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.