GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 295 of 494    Print  
Why java does not have multiple inheritance?
but in c++ ?


  
Total Answers and Comments: 6 Last Update: October 02, 2006     Asked by: madhu sankar 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 16, 2006 08:13:25   #1  
Amit Rana        

RE: Why java does not have multiple inheritance?...
Java supports the multiple inheritance but only in interfaces. It means you can implements more than one interfaces but you can't extends more than one classes. So we can't say that Java doesn't support multiple inheritance.
 
Is this answer useful? Yes | No
August 16, 2006 09:37:15   #2  
saumendra11 Member Since: August 2006   Contribution: 5    

RE: Why java does not have multiple inheritance?...
java doesnot support multiple inheritance.in c++ ,there is a ambiguty problems occers due to multiple inheritance.
 
Is this answer useful? Yes | No
September 07, 2006 09:46:10   #3  
praveenkumar        

RE: Why java does not have multiple inheritance?...
C++ is apt languge for both commercial and scientific applications but C++ has bit of complexity with multiple inheritnce Java emphasis in commercial applications it tried to eliminate the complex bit
 
Is this answer useful? Yes | No
September 14, 2006 11:06:23   #4  
kathie siera        

RE: Why java does not have multiple inheritance?...

it can using implementing multiple interfaces...

but its a big concept batter u go through head first series JAVA


 
Is this answer useful? Yes | No
September 14, 2006 22:54:24   #5  
Ramakanth_Burra Member Since: September 2006   Contribution: 1    

RE: Why java does not have multiple inheritance?...

The main reason that Multiple Inheritance was omitted from Java was because from a design perspective, muliple inheritance will cause problems. It may seem to us that it solves many problems but eventually, it also creates problems along with complexity. So the very objective of java being "Simple" gets defeated. Therefore the founders of java have cut Multiple Inheritance from the language.

Just a point to add that, mulitple interface inheritance is perfectly allowed. This idea was brought up from C's protocols.

Thanks,

Ram


 
Is this answer useful? Yes | No
October 02, 2006 15:37:52   #6  
ashish_setia Member Since: October 2006   Contribution: 15    

RE: Why java does not have multiple inheritance?...

yes this is absoluetly true, in java we dont hav multiple inhet. actually multiple inheritance means a drive class is having mare than one base class. just as it will create the popular diomound problem

eg. class A is a bAse class

Class B and Class C are its drive classes

and Class d is inheting both B and C

then if D's object tries to acces a method from its base class then whos method will be called (Weather from B or C)this was the problem and C++ makes THe Virtual base class to solve it. but java doesnt support it bcoz it create more problem then solving .


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape