aspose file tools*
The moose likes Java in General and the fly likes Why one Super Class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why one Super Class?" Watch "Why one Super Class?" New topic
Author

Why one Super Class?

Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Author Jacquie / My fellow ranchers,

We all very well know that all the classes extend "java.lang.Object".

I was just thinking, why was such a design made. What are the advantages, that would be the fruits of this particular behaviour.

Care to explain?

Cheers,
Ram
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Well in my view, everything is an object so some *qualities* that all should have (quality of object because all are object) are kept in Object class and all classes are implicitly sub class of Object.
Vasilis Karas
Greenhorn

Joined: Mar 16, 2004
Posts: 24
Ram,
let me complement your question and ask why not? Is there a limitation that you've encountered??
This question is one for the true computer scientist which I won't pretend to be.
My guess would lead me to what the proponents (I'm included) of Java hail as it's greatest benefits:

1)Built as an easy to use and pure OO language
2)Is platform independent
3)Built with multi-threading in mind--

Hopefully all see these as fairly accurate statements...

These attributes most likely required a common superclass so our beloved JVM (platform specific) can work appropriately: regaining memory on any system (gc) and control it's threads (wait(), notify(), notifyAll())...

A more creationist view may be that because all matter (Objects in this case) be created from one source

Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Vasilis,

Thanks for the post. I agree with you.

By the way, i did not face any limitations, with this implementation.

I have thought of all these common features in a single place holder, easy to implement,OO, etc...

But the perspective in which i had put my question here is to just know what was the design condition, beyond all these, and how it helps in the internals of the JVM, other that this gc, threads, etc...

Cheers,
Ram.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5274
    
  10

Here's an article that talks about the benefits of a singly-rooted hierarchy:

http://www.codeguru.com/java/tij/tij0024.shtml


Junilu - [How to Ask Questions] [How to Answer Questions]
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Junilu,

This is really a good information. Thanks a lot, for letting me know.

Cheers,
Ram.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why one Super Class?