• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with Object class

 
Arun kumar Maalik
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir
would U tell me that why all(almost all) classes in java are derived from Object classes. Pls sugets me.

With regard
Arun kumar maalik
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All classes, except for Object, extend exactly one other class. If you are defining a new class and you don't explicitly specify a parent class, then its parent is Object, by default.

Why? That's just how it works. Java has a "single-rooted" object inheritance tree, like Smalltalk or the old NIH class library for C++.
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!