Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inheritence

 
karthika gkumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in java all the classes are extend with Object class implicitly.
java does not support multiple inheritence.
but when we are extending a class with some other class doesnt that mean that class is extended twice?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Multiple inheritance specifically means inheriting from several classes directly. A class can have only one direct parent class. The fact that the parent has its own parent doesn't matter.
 
abhishek pendkay
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
karthika
in java all the classes are extend with Object class implicitly.


the correct statement would be
in java all classes that do not extend from any other class extend from the Object class so if your class in extending from some other class it will not directly extend from Object... so there is no multiple inheritance problem..
[ April 18, 2008: Message edited by: abhishek pendkay ]
 
karthika gkumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
Kuldeep Singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hidear
I would like to add some more.
it is called maultilevel inheritence which you are explnig exctly.
when we say multiple that means extends morethen oneclass. as you may see in C plus plus.
if we extend two class to one single class by extending 2-times then it is not not fair.
[ April 21, 2008: Message edited by: Kuldeep withDreams ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic