• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object extends Object

 
mohan rajv
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In java all classes extends Object class implicitly..
Object also a class in java
then is that also extends Object??!!
I am confused with this.can anyone explain with this problem?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javadocs of a class -java.lang.Object included- will tell you which class it extends, if any.
 
mohan rajv
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that javadoc it extends nothing.
but my doubt is we are not specifying anywhere our class extends Object,implicitly it extends Object na?
like this Object class how works?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Object JavaDocs:
Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Language Specification is always a good place to start when looking for answers to questions like these

Section 8.1.4
The extends clause must not appear in the definition of the class Object, because it is the primordial class and has no direct superclass.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic