This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Why Objcet is the Base class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why Objcet is the Base class?" Watch "Why Objcet is the Base class?" New topic

Why Objcet is the Base class?

Santosh Maskar
Ranch Hand

Joined: Jul 02, 2003
Posts: 226
Why Sun took such a design decision for Objcet class as a Base class.

What is the speciail about the Objcet and why all classeses implemtes Object by default

Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
1. There are some methods common to all objects, like toString:

How could you have written such code without Object?

2. The Collection Framework (java.util.List, Set, Map, etc...)
rely heavily on Object to allow the defintion of general collections:

The current version of Java (1.5) compilcates this point with generics,
but the argument can still be made: Having a common base class is
very useful. C++, as you may know, lacks this, and most C++ Frameworks
begin by defining base classes that most their classes derive from,
directly or indirectly...

There is no emoticon for what I am feeling!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Why Objcet is the Base class?
Similar Threads
compare: are two objects from the same class
Method call as an object reference
Aggregation And Inheritence
super inside a base class constructor
<jsp:UseBean> can also CREATE a bean! Or can it?