aspose file tools*
The moose likes Beginning Java and the fly likes why Object Class was chosen Parent to all java classes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why Object Class was chosen Parent to all java classes?" Watch "why Object Class was chosen Parent to all java classes?" New topic
Author

why Object Class was chosen Parent to all java classes?

kesava chaitanya
Ranch Hand

Joined: Aug 15, 2001
Posts: 140
why Object Class was chosen Parent to all java classes?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
it sounded like a good idea at the time


42
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Java borrowed alot of ideas from Smalltalk. In Smalltalk everything is an object
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
because every object in java is an umm.. object and all the properties and methods common to all objects are in the Object class
Mahesh Bhatt
Ranch Hand

Joined: Sep 15, 2004
Posts: 88
Hi All,
I think the reason was, They designed a class named 'Object' which had a few really good methods and then they used the benefits of inheritance. So now whenever we define a class, we have a few methods from the Object class as well.

Can anybody out there, give a really good explaination about this. I think there is much much more than, what appears here.


Impossible is I M Possible
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
In Java it is important to understand what the definition of an object is.
An object is a class instance or an array

This definition is slightly different from that of SmallTalk, C++ and a host of other OO languages.

The reason this is significant is that Interfaces in Java are not considered Objects and therefore, we are allowed to implement more than one Interface while only extending only one direct Superclass. Other languages allow for inheritence from more than one superclass (multiple polymorphism),
in java this can only be achieved by abstract classes using other abstract classes.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Consider how nicely the single base class called Object works out for us. You can take any kind of object at all and store it in an Object variable or pass it to an Object parameter:

Lists and Maps and Sets and such can store any object because they are written this way.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why Object Class was chosen Parent to all java classes?
 
Similar Threads
Help with Object class
why we exteds object
What does a "one to many" relationship mean
Super Class
How can multiple inheritance solve the problem of Deadly Diamond of Death