Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

why multiple inheritance is not supported by java?

This is a discussion on why multiple inheritance is not supported by java? within the Java forums, part of the Software Development category; why multiple inheritance is not supported by java?...

Go Back   Geeks Talk > Software Development > Java
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Java Java related Issues and Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-25-2008
Junior Member
 
Join Date: Feb 2008
Posts: 3
Thanks: 0
Thanked 3 Times in 2 Posts
varanasisaikarthik is on a distinguished road
Thumbs down why multiple inheritance is not supported by java?

why multiple inheritance is not supported by java?
Reply With Quote
The Following 2 Users Say Thank You to varanasisaikarthik For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 03-05-2008
Junior Member
 
Join Date: Jan 2008
Location: hyderabad
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
ravitcs is on a distinguished road
Re: why multiple inheritance is not supported by java?

java was designed in that way it doesnt support syntactically but conceptually it is possible with interfaces
Reply With Quote
  #3 (permalink)  
Old 03-05-2008
Junior Member
 
Join Date: Mar 2008
Location: chennai
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
raghavrules is on a distinguished road
Re: why multiple inheritance is not supported by java?

that is because if a child is inheriting from two classes ,and if both the parent classes have the same method (same signature and same return type),the compiler will be confused as the method in the child overrides which parent
Reply With Quote
The Following User Says Thank You to raghavrules For This Useful Post:
  #4 (permalink)  
Old 03-09-2008
Junior Member
 
Join Date: Mar 2008
Location: Orissa
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
suhasini59 is on a distinguished road
Re: why multiple inheritance is not supported by java?

in c++ also the multiple inheritance is there but due to ur saying reason we use the virtual function in c++.In java also we can use the virtual function so whats the deffect to use the multiple inheritance
Reply With Quote
  #5 (permalink)  
Old 08-20-2009
Junior Member
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
shreya suri is on a distinguished road
Re: why multiple inheritance is not supported by java?

actually we can use it,but indirectly witn the help of interfaces..
but my qs. is why not directly..?
Reply With Quote
The Following User Says Thank You to shreya suri For This Useful Post:
  #6 (permalink)  
Old 08-20-2009
Junior Member
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
shreya suri is on a distinguished road
Re: why multiple inheritance is not supported by java?

what are actually interfaces?
Reply With Quote
  #7 (permalink)  
Old 08-20-2009
Expert Member
 
Join Date: May 2009
Location: Bangalore
Posts: 989
Thanks: 155
Thanked 420 Times in 201 Posts
rijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nice
Re: why multiple inheritance is not supported by java?

Quote:
Originally Posted by shreya suri View Post
what are actually interfaces?
Hi ,

Interface is the collection of methods with empty implementations and constants variables ( variables with static and final declarations ).

All the methods in an interface are "public and abstract" by default. Since interfaces are abstract in nature so they can not be directly instantiated.

To define the methods of an interface the keyword "implements" is used.

Eg:


interface check
{
public void message();
}
public class Interface {
public static void main(String[] args) {
try {
check t = new check() {
public void message() {
System.out.println("Method defined in the interface");
}
};
t.message();
} catch (Exception ex) {
System.out.println("" + ex.getMessage());
}
}
}

If any query let me know....


Thanks,
Riju.
Reply With Quote
  #8 (permalink)  
Old 09-08-2009
Junior Member
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Confusedcoder is on a distinguished road
Re: why multiple inheritance is not supported by java?

i dont think just because making the java simple and robust we don't have mulitple inhertiance and if it so why do they provided Interface concept for us....
and one thing more that we can have same method name with same return type via METHOD OVERRIDING...
Reply With Quote
  #9 (permalink)  
Old 09-11-2009
Junior Member
 
Join Date: Sep 2009
Posts: 3
Thanks: 1
Thanked 1 Time in 1 Post
megha131313 is on a distinguished road
Thumbs down Re: why multiple inheritance is not supported by java?

Quote:
Originally Posted by shreya suri View Post
what are actually interfaces?
interfaces are there in java to support polymorphism not for multiple inheritance java not at all support multiple inheritance
Reply With Quote
  #10 (permalink)  
Old 3 Weeks Ago
Junior Member
 
Join Date: Oct 2009
Location: bangalore
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
elangobabu is on a distinguished road
Re: why multiple inheritance is not supported by java?

hi fnds

in java we have diamond property . i.m if the two parent class have the same method signature and different implementations the the jvm confused which parent class method it invoke....... this naming convention is called diamond property in java.

thats y in java it doesn't support multiple inheritance directly, but it suppots indirect multiple inheritance throw interfaces bcz if the two in interfaces having same name even thow that method implementation existeds only once in the child class .....so there is no confusion to jvm which method implementation it invoke.........
Reply With Quote
Reply

  Geeks Talk > Software Development > Java

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
multiple inheritance in java... psuresh1982 Java 20 07-23-2007 02:33 PM
Default add-ins supported by the QTP 9.2 Geek_Guest QTP 1 07-11-2007 03:50 PM
Clarification regarding Java Interface and Inheritance Geek_Guest JSP 4 06-15-2007 08:46 AM
multiple inheritance.... psuresh1982 Java 2 01-22-2007 12:57 AM
Applications supported by QTP deeptik_81 QTP 2 12-19-2006 05:00 AM


All times are GMT -4. The time now is 12:16 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved