ALLInterview.com :: Home Page KalAajKal.com
 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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
why java does not support multiple inheritance
 Question Submitted By :: Stalin
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why java does not support multiple inheritance
Answer
# 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 ?    40 Yes 11 No
Kishore
 
  Re: why java does not support multiple inheritance
Answer
# 2
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 ?    29 Yes 9 No
Smitha
 
 
 
  Re: why java does not support multiple inheritance
Answer
# 3
java defenetly support multiple inheritance.it can be done 
by the keyword called super.java does not support the 
multilevel inheritance
 
Is This Answer Correct ?    3 Yes 53 No
Kalaivani
 
  Re: why java does not support multiple inheritance
Answer
# 4
Java was designed without multiple inheritance.Java
interfaces solves most problems that are commonly solved
using multiple inheritance just simulates inheritance .

 Kalaivani , Kishore don't misguide others unless your
absolute with your answers.
 
Is This Answer Correct ?    4 Yes 11 No
Sskur
 
  Re: why java does not support multiple inheritance
Answer
# 5
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 ?    28 Yes 3 No
Sskur
 
  Re: why java does not support multiple inheritance
Answer
# 6
Because  in java a class doesn't extend more than one class
 
Is This Answer Correct ?    3 Yes 22 No
Lalatendu
 
  Re: why java does not support multiple inheritance
Answer
# 7
Basically multiple inheritance is useful only in 
polymorphism, so in java it can be done by interfaces, so 
that java doesn't need to provide multiple inheritance 
using extends keyword.
 
Is This Answer Correct ?    10 Yes 2 No
Devesh Dashora
 
  Re: why java does not support multiple inheritance
Answer
# 8
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 ?    3 Yes 0 No
Mukul
 
  Re: why java does not support multiple inheritance
Answer
# 9
Multiple inheritance in Java is not allowed directly simply 
because Java has another concept of Interfaces that replace 
the ambiguity of this problem in other OOP languages such 
as C++.
 
Is This Answer Correct ?    2 Yes 2 No
Ouali International
 
  Re: why java does not support multiple inheritance
Answer
# 10
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 ?    6 Yes 0 No
Priyanka
 
  Re: why java does not support multiple inheritance
Answer
# 11
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
 
Is This Answer Correct ?    3 Yes 0 No
Priyanka Patil
 
  Re: why java does not support multiple inheritance
Answer
# 12
multiple inheritance means a sub class which is derived from
two base classes.

assume that the two base classes has same methods with same
signature.
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
inheritance.
 
Is This Answer Correct ?    3 Yes 1 No
Shiva
 
  Re: why java does not support multiple inheritance
Answer
# 13
java does not support multiple inheritance because in java 
we can develop web based application
suppose we r trying 2 download a file that has  extended 
many classes if 995 of classes get downloaded and even 1% 
gives error in downloading then there is no use of 
downloading

that's why java avoid such comlexities of interdependency 
so it avoid multiple inheritance
 
Is This Answer Correct ?    2 Yes 2 No
Reshma Mittal
 
  Re: why java does not support multiple inheritance
Answer
# 14
Java support method overriding means both superclass and 
subclass can have the same method name and number of 
arguments.If java support multiple inheritance, ambiguity 
problem will arise if two or more superclass have the same 
method name, and the super keyword will not be able to 
decide which superclass to call.
TO remove such ambiguity problem java doen not support 
multiple inheritance through extend but it support it 
through interface.
 
Is This Answer Correct ?    0 Yes 0 No
Dewanshu
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Difference between canvas class & graphics class?  1
what is abstract method with example? Virtusa5
transaction attributes ?  2
Can a Byte object be cast to a double value?  2
Why can't we make jsp as a controller and action servlet in struts? TCS6
What is a thin-client application? Adobe5
what is main purpose of abstract class?  2
why the constructor should be used in class,if there is no constructor what will happen?  4
What is the difference between Trusted and Untrusted Applet ? IBM1
What is the difference between serialization and deserialization? ABC2
What is an exception?  4
How to make class immutable  5
What is the root class for all Java classes?  4
why Runnable interface is preferable than extending the Thread class? Wipro5
Difference between this(), super()?  8
I/O blocking means?  1
what is the Yield() method used in threads? Accenture2
Why is prepared Statement, Callable Statement used for? What is the need of Batch updates? Logica-CMG1
Explain the differences between public, private, protected and static?  3
can we have virtual functions in java? Wipro7
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com