Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

why java not providing multiple inheritance

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

please anybody tell me why java does not provide mutiple inheritance


Thanks
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question is answered in this article
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Java does allow multiple inheritance via use of Super references and implementing interfaces. See A Programmers Guide to Java Certification copyright 2000 by Khalid A. Mughal. Example 6.9 and page 198.

Looking forward to other responses to this question.
[ December 16, 2005: Message edited by: LJ Bell LJ Bell ]
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi prashant,

as LJ Bell LJ Bell saya that java allow multiple inheritance using interface and super referance

there is another method with the help of which you can achive multiple inheritance

first understand inner class concept => class inside class ok

now what is multiple inheritance

class parent1 class parent2

class child1

in child1 you are able to access method from both classes p1 and p2

now see inner classes

class outside extend parent1
{
code{}

class inner extends parent2
{ code----
}
}

now using object of inner class you are able to access method from both both parent class








 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think all should check the link provided by Nigel Browne. It is eshustively discussed there. thank u
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
amod gole brought up some really good points. When I started learning about inheritnace, dynamic binding, polymorphism, it took me a while to understand the ramifications of it all.

But with single inheritance, it is only driect inheritance, but you are inheriting a "single line" if you will from multiple classes. Just like Class Object. We might create a parent but the child inherits from diectly from the parent but also from Object, which is the parent to our parent class.

Interfaces allow direct inheritance from multiple classes. Once you start using the Component class and using such things as JFrame, JPanel, etc, and notice their immensity and "tree of inheritance," and get into event driven programming you'll see how awesome inheritance is and the imortance of interfaces.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Why Java does not support Pointers?"
"Why there is no goto statement in java?"

The answer is same.... To make it simple and avoid complex programming.

Thanks.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic