:: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Categories >> Software >> Java Related >> Java J2EE >> Core Java


 Core Java interview questions  Core Java Interview Questions (1728)
 Advanced Java interview questions  Advanced Java Interview Questions (332)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
why java does not support multiple inheritance
 Question Submitted By :: Core-Java
I also faced this Question!!     Answer Posted By  
# 1
Java absolutly support multiple inheritence in terms of
Interface.We can extend one class only to avoid ambiguity
problem.In interface we have to define the functions.So we
don't get any ambiguity.In c++ it is big problem with
multiple inheritence but in JAVA this thing is improved by
introducing Interfaces
Is This Answer Correct ?    296 Yes 83 No
# 2
To say why java doesn't support inheritance directly like c++
should be the diamond problem faced by c++,

(Diamond problem is an ambiguity that arises when two
classes B and C inherit from A, and class D inherits from
both B and C. If a method in D calls a method defined in A
(and does not override it), and B and C have overridden that
method differently, then via which class does it inherit: B,
or C?)
Is This Answer Correct ?    198 Yes 18 No
# 3
Java supports multiple inheritence indirectly through the
use of interface. In case we are able to extend more than
one class then there would be a confusion of which method to
process in case both classes have same method name(Same
method signature also).

In case of using interfaces to support multiple inheritance
we escape this problem as we define the methods that are
needed only.
Is This Answer Correct ?    227 Yes 50 No
# 4
java does not supports multiple inheritence at all.but it
supports similar feature interface.Which removes the
ambiguity problem(Deadly Diamonds Of Death) and complexity
of multiple inheritence.Although interface is not the part
of inheritence because inheirtence is achieved in java
through extends keyword only.Interface is the part of
aggregation not inheritence.
Is This Answer Correct ?    44 Yes 12 No
# 5
Multiple inheritance means derive class from multiple
classes but java can't extend multiple classes. it can
extend one class but multiple interfaces. so create
multiple interfaces n then implement it.

Java have such fzacility to avoid ambiguty.
Thank u
Is This Answer Correct ?    34 Yes 17 No
# 6
multiple inheritance means a sub class which is derived from
two base classes.

assume that the two base classes has same methods with same
for eg we create an object for the base class.

now call the any one method of base class with sub class object.
now which method is going to execute?
To avoid this confusion java doesnot support multiple
Is This Answer Correct ?    18 Yes 5 No
# 7
java doesn't support multiple inheritance directly because it leads to overiding of methods when both extended class have a same method name. this will leads to ambiguity in executing. this problem can be solved using interface which works similar to the multiple inheritance but the methods are defined in the subsequent classes so it does not create any ambiguity. 
Is This Answer Correct ?    5 Yes 0 No
# 8
Java does not support Multiple inheritance Directly, But it
will support indirectly through Interface.
Is This Answer Correct ?    6 Yes 3 No
# 9
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

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
Is This Answer Correct ?    6 Yes 4 No
Priyanka Patil
# 10
java is extended from C++ language.
in c++ we found Multiple inheritance make complexity or
confusion to called method.

example: suppose class A extends class B and class C

class B have method area(int i);
class C have method area(int i);

now if Class A call area(int i) then whose method will be

contact me if any query about java

Is This Answer Correct ?    2 Yes 0 No
Piyush Patel

Other Core Java Interview Questions
  Question Asked @ Answers
why java does compile time polymorphism at run time ? TCS 4
why String class is immutable. iGate 5
Name the packages in JDK?   2
what is the difference between AWT and SWING what is the advantage of using swing?   3
What are the similarities between an array and an ArrayList?   3
What is the difference between a public and a non-public class?   2
There are 100 keys and values in to get the keys and values? IBS 1
What is the difference between Checked and Unchecked exception? Give some examples Ness-Technologies 2
Difference between Reader/Writer and InputStream/Output Stream? Kirusa 9
Write program to print Hello World and print each character address in that string and print how many times each character is in that string? Ex: H: 0 & 1 e:1 & 1 l :2,3,8 & 3 o:4,6 & 2 w:5 & 1 r: 7 & 1 d 9 & 1 Huawei 7
What is an Iterator interface?   2
How can you eliminate duplicates?   2
For more Core Java Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::