Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Is multiple inheritance allowed in Java? Why ?

Answers were Sorted based on User's Feedback



Is multiple inheritance allowed in Java? Why ?..

Answer / midhun h kumar

No ...
Multiple inheritance is not allowed in Java...
but infact we can achieve the functionality using interfaces...
we can define interfaces and any class can implement these
interfaces..
a class can implement any number of interfaces but can
extend only one class..
thus we can achieve what we expect to get from multiple
inheritance thru interfaces...

Is This Answer Correct ?    10 Yes 2 No

Is multiple inheritance allowed in Java? Why ?..

Answer / shivaprasad

Multiple inheritance is not allowed in java because it creates
DIAMOND PROBLEM.
DIAMOND PROBLEM: Suppose classes B and C extend A and
class D extends to both B and C(multiple inheritance). Now,
if D calls a method in A then it does not know from which
class it has to inherit(either B or C). This is called
diamond problem.

Is This Answer Correct ?    8 Yes 1 No

Is multiple inheritance allowed in Java? Why ?..

Answer / aditya mohata

no.it's not allowed.

Is This Answer Correct ?    5 Yes 1 No

Is multiple inheritance allowed in Java? Why ?..

Answer / bhasker tiwari

All the answer given above are True .
but i would like to add few more.
Reasons are follows:
1.As java creates .class for each Java file.and As all java
files has there own variable and methods so incase of
Multiple inheritence all will mess up , so to avoid this
situation Java do not allow Multiple Inheritence.
2. the above discussed Diamond problem is also a Reason.

Is This Answer Correct ?    4 Yes 2 No

Is multiple inheritance allowed in Java? Why ?..

Answer / ravikiran(aptech mumbai)

Not in a direct manner we can achieve it with the help of
interfaces

Is This Answer Correct ?    1 Yes 0 No

Is multiple inheritance allowed in Java? Why ?..

Answer / karthik

"Can some one explain about this case.

-> A is a super class and B extends from A.
-> java.lang.Object is super class for all classes.

now in this case B extends from A and B extend from java.lang.Object(because is default super class) then it is multiple inheritence right? "

Mr Suresh Aelidhe,

If a class extends any other class then it wont extends Object class

Is This Answer Correct ?    1 Yes 0 No

Is multiple inheritance allowed in Java? Why ?..

Answer / suresh aelidhe

Can some one explain about this case.

-> A is a super class and B extends from A.
-> java.lang.Object is super class for all classes.

now in this case B extends from A and B extend from java.lang.Object(because is default super class) then it is multiple inheritence right?

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is arrays sort in java?

0 Answers  


What is the alternate of 'Inheritance' ?

4 Answers   CybAge, HCL,


What is the use of protected in java?

0 Answers  


How many bits is a double?

0 Answers  


Difference between prefix and postfix forms of the ++operator?

3 Answers  


What is the difference between class & object?

0 Answers  


What is a dynamic array java?

0 Answers  


What are the characteristics provided in jdk1.6 apart from other versions?

3 Answers   TCS,


StringBuilder s = new StringBuilder("Hello Mom");s.append(",I mean,Mother"); Response.Write(s.ToString()); String s = "Hello Mom"; s+ = ",I mean Mom"; Response.Write(s); Which is faster ? which uses the most memory?

6 Answers   HCL,


What is Enum in Java?

0 Answers  


explain copyonwritearraylist and when do we use copyonwritearraylist?

0 Answers  


What are the advantages of java inner classes?

0 Answers  


Categories