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                      
tip   SiteMap shows list of All Categories in this site.
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 not supproting multiple inheritance?
 Question Submitted By :: AnithaBabu1
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why java not supproting multiple inheritance?
Answer
# 1
well as in c++ we have multiple inheritance, but not in java

becz if it is their then having method of same signature
(means same return type, list of paraments, access 
specifiers) in 2 different classes and both r extended by 
some class AA then while calling method in base class, it 
would break down the jvm that to which classes method to be 
called.
EX:-
class BB
{
 public void a(int x)
 {
  System.out.println("call from BB");
 }
}
class CC
{
 public void a(int x)
 {
  System.out.println("call fro CC");
 }
}
class AA extends BB,CC
{
 a(5);
}
 
Is This Answer Correct ?    3 Yes 1 No
Aman Kr. Aggarwal
 
  Re: why java not supproting multiple inheritance?
Answer
# 2
Why? Because it gets confusing.
 
Is This Answer Correct ?    0 Yes 1 No
Xkrebstarx
 
 
 
  Re: why java not supproting multiple inheritance?
Answer
# 3
BCoz of DIAMOND Problem......if A extends B & B extends 
A..in this case b wil override the methods of A class..if c 
Extends A ..in this case  C wil hav Both the properties of 
A,B ....if D extends  A which properties should D 
inherits ..if it B,C propetries Bcoz B are having the same 
methods of A & c is having the same methods of A...there 
occurs the Diamond problem..
 
Is This Answer Correct ?    2 Yes 1 No
Ershad
 
  Re: why java not supproting multiple inheritance?
Answer
# 4
Java doesn’t provide multiple inheritance (MI), at least 
not in the same sense that C++ does. Like
protected, MI seems like a good idea but you know you need 
it only when you are face to face with a
certain design problem. Since Java uses a singly-rooted 
hierarchy, you’ll probably run into fewer situations in 
which MI is necessary. The interface keyword takes care of 
combining multiple interfaces.
 
Is This Answer Correct ?    0 Yes 0 No
Venkatachalapathy
 
  Re: why java not supproting multiple inheritance?
Answer
# 5
java does not support multiple inheritance directly because


if we r deriving a sub class from 2 super classes which are 
as follows

class A
{
 void meth()
 {
  // substraction;
 }
}

class B
{
 void meth()
 {
  // Addition;
 }
}
   
class C extends A,B
{
 meth()<--- system get into confusion whether its add
             or substarct.
}
 
Is This Answer Correct ?    1 Yes 0 No
Tulasi Prasad
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What is the range of the char type?  2
what is Inheritense Tech-Mahindra1
How to transfer data from an Applet to Servlet ?  1
How to set the Heap size in Java ? HCL2
What classes of exceptions, caught by a catch clause?  1
What is a super class and how super class be called?  3
Difference between Array and vector?  4
What are access modifiers in Java ?  5
How to call static method? Epoch3
What is the immediate superclass of the Dialog class?  1
Differentiate Vector and ArrayList? Wipro4
Difference String and String Buffer  3
Which containers may have a MenuBar?  1
what is webservices Mind-Tree4
explain me with a code snippet about the generation and handling of null point exceptions.  1
How do u provide security in java  1
Explain method overloading and overriding?  6
What is an enumeration class?  2
what are the different access specifiers that can be used by interfaces and abstract classes? can anyone give me detailed description on this  7
Program to output as below formate: 1 2 3 4 5 6 7 8 9 10 Huawei2
 
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