• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object class - the super class for all in java  RSS feed

 
shanthi naidu
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This might be a simple question.

Every one knows that every class in java extends the Object class.
But we explicitly never use the extends key word still we can make use
of the methods of Object class.

How this will be acheived internally i dont know... please anyone can explain me?

Thank you,
Shanthi Naidu.




 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shanthi naidu wrote: . . . we explicitly never use the extends key word still we can make use
of the methods of Object class. . . .
You can if you want to.The compiler automatically imputes "extends java.lang.Object" to every class file which does not already have an "extends" clause. Look at any of your .class files and open it with javap -c Foo, and you will see it has "extends java.lang.Object" at its head.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!