:: 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 (1721)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 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 (146)
 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 ?    294 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 ?    226 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 ?    17 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 does not support multiple inheritance because of ambiguity 0r confusion problem.but multiple inheritance can be achieved through the concept called interfaces.
A class can implement one or more interfaces.
class A extends B extends C
//Not possible
class A extends B implements C
// Possible
from interface to class we are inheriting use the keyword
Is This Answer Correct ?    3 Yes 1 No

Other Core Java Interview Questions
  Question Asked @ Answers
can u override the start() method of Thread class   4
can we overload main method? TCS 8
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.   1
Given: 1. package test; 2. 3. class Target { 4. public String name = “hello”; 5. } What can directly access and change the value of the variable name? 1 any class 2 only the Target class 3 any class in the test package 4 any class that extends Target Infosys 7
What are the standards to place package statement within a source code file?   1
How Marker Interfaces are instruct to complete the desired need ?   2
Write POJO class as a key to hashmap???   2
which of tha following is not a thread safe class? a) ArrayList b)Vector c)HashTable d)None   17
What is user defined exception?   4
why an outer class cannot be declared as private?   1
Instead of writing Home, Remote Interfaces if i directly extends EJBObject to bean class what happens? Flextronics 1
Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thread tries to access a particular resource we can lock the method using synchronized keyword. Then after that how the lock is released and how next thread access that.Please explain with example.   5
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.   ::