Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

why java doesn't supprot multiple inheritance

  Asked By: Robert    Date: Sep 26    Category: Java    Views: 1180

i have some questions about java
why java doe not supprot multiple inheritance...?
What is meant by a resource leak?
Name interfaces without a method ?
What is the method to find if the object exited or not ?
Can thread become a member of another thread ?
What is meant by time-slicing ?



2 Answers Found

Answer #1    Answered By: Jaime Bowman     Answered On: Sep 26

I would like to anwser some questions  as follows:

Java does not really support multiple  inheritance but
Java support a new mechanism, which can solve multiple
inheritance. It is 'Interface' and 'Implementation
interfaces'. You should integrated this mechanism with
another mechanism 'Aggregation' I think you can solve
every problems multiple inheritance.

In java, you does not care memory problem, JVM will
care them but sometime you should use 'garbage
collection mechanism' in order to free unneccessary
elements when you build specific projects, such as
project that has high complex or their execution is
persistent for a long time.

When you are a guru, you show excellent architectures
and you believe that they will use all over the world
by almost organization, companies even though
programmers. For this reason I will hope make a
standard interface so that everybody will do follow it
and you will also continue develop or extend them.

Almost questtions, which were shown here I think you
will totally understand when you work with Java
language for a long time.

Answer #2    Answered By: Brandon Tucker     Answered On: Sep 26

Whenever you find  yourself asking why Java has or does
not have some feature, consider the design goals
behind the Java language.

As the white paper states, the Java design team strove
to make Java:
1.Simple, object  oriented, and familiar
2.Robust and secure
3.Architecture neutral and portable
4.High performance
5.Interpreted, threaded, and dynamic
The reasons for omitting multiple  inheritance from the
Java language mostly stem from the "simple, object
oriented, and familiar" goal. As a simple language,
Java's creators wanted a language that most developers
could grasp without extensive training. To that end,
they worked to make the language as similar to C++ as
possible (familiar) without carrying over C++'s
unnecessary complexity (simple).

In the designers' opinion, multiple inheritance  causes
more problems and confusion than it solves. So they
cut multiple inheritance from the language (just as
they cut operator overloading). The designers'
extensive C++ experience taught them that multiple
inheritance just wasn't worth the headache.

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.

Multiple interface inheritance still allows an object
to inherit methods and to behave polymorphically on
those methods. The inheriting object just doesn't get
an implementation free ride.

Didn't find what you were looking for? Find more on why java doesn't supprot multiple inheritance Or get search suggestion and latest updates.