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 Don't Support Multiple interitence
 Question Submitted By :: Manishjavaguru
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Why java Don't Support Multiple interitence
Answer
# 1
Multiple Inheritance is not supported by java in order to
avoid ambiguity between variables of different classes and
to rudece memory overloading.
 
Is This Answer Correct ?    19 Yes 1 No
G Ch Vishnu Vardhan Reddy
 
  Re: Why java Don't Support Multiple interitence
Answer
# 2
There is a big reason behind that(java does not support 
multiple inheritance). Please go through the following 
example.

1. Assume that java is supporting multiple inheritance 

class A {

  void m1() {
        // implement method 
  }
}

class B {
  void m1() {
        // implement method
  }
}
//As for the assumption (1) the following code will compile

class C extends A,B {

   public static void main( String s[]) {
   
     C c = new C();
     c.m1();
   }
}

Note : In main method i am calling c.m1() method In this 
situation which super class m1 method has to call (from A 
or B) JVM will confuse.

So our assumtion(1) is wrong .

This is the  reason why java does not support multple 
inheritance through classes.

Note : This same cocept is applicable for classes.
 
Is This Answer Correct ?    12 Yes 2 No
Bhaskar Reddy
 
 
 
  Re: Why java Don't Support Multiple interitence
Answer
# 3
ya java don't support multiple interitence but by achieving
it the interface are came
 
Is This Answer Correct ?    1 Yes 3 No
Kiranksj
 
  Re: Why java Don't Support Multiple interitence
Answer
# 4
The famous "diamond shaped problem " is the reason behind NOT using multiple inheritance in java.
   check out this link for full details
       http://en.wikipedia.org/wiki/Diamond_problem
 
Is This Answer Correct ?    0 Yes 2 No
Sid
 
  Re: Why java Don't Support Multiple interitence
Answer
# 5
java support multiple inheritance not through the use of
class, but through the implementation of interface we can
achieve multiple inheritance.

By using interface we can implement multiple interfaces for
a class which can solve the problem of our multiple inheritance.
 
Is This Answer Correct ?    0 Yes 2 No
Samir Rana
 
  Re: Why java Don't Support Multiple interitence
Answer
# 6
Java Does not support Multiple inhertiance through class
because ambiguity between variables  of different classes
and to rudece memory overloading.and another reason java 
extended only one class at time

java support Multiple inhertiance through interfaces.because
java class implements any number of interface at  time
 
Is This Answer Correct ?    0 Yes 1 No
Srinu
 
  Re: Why java Don't Support Multiple interitence
Answer
# 7
Why cant we face same ambiguity when we declare variables?  
interface A{
int i = 10;
}
interface B{
int i = 20;
}
Class C implement A, B{
what is the value of C.i?
}
 
Is This Answer Correct ?    0 Yes 0 No
Sanjeev
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
can we have virtual functions in java? Wipro7
What happens when you assigned a 'double' value to a 'String'?  6
What are uses of Hash Code? Cognizent2
whst is encapsulation?when u encpsulate actually while devoloping code? AMDOC5
Differences between GridLayout and GridBagLayout?  1
when we have to use final class in java?  2
How do you relate a Interface to a Class? Tell me in Detail?  4
What is the purpose of the File class?  2
What modifiers can be used with a local inner class?  2
Does a class inherit the constructor of its super class?if it does, how can you hide that constructor? if it doesnot how can you call it from the sub class?  1
Name the immediate superclass of the MenuComponent class?  1
How to synchonise HashMap IBM3
Explain about GridBag Layout?  1
Can we place the any object to key attribute of HashMap<key,value>? HCL3
How to re-get an object that is collected by garbage collector?  1
Name the class that used to read objects directly from a stream? Wipro2
what are the differences between final,finally,finalize methods?  7
Is 'null' a keyword?  3
explain about casting of objects?  4
What primitive Java types? Howmany are they and what are their names?  3
 
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