Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • 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
Marshal
Pie
Posts: 24212
35
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++.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic