A question so simple , yet confusing to decifer , why is the superclass of all classes in java named as 'object' class ? It could be anything else , any particular reason/thoughts for the same would be helpful.
It ts very good question and must be ansarable.Every class extends Object class Because of 2 resion,one is for security resion & other for utilities purpose.If a class Extends Object class ,then after jvm,cosider this program is secure program(thats the only way that jvm know program compile by bug free compiler or bug compiler).Other is about the utilites,thats G.C,&other functionalites.
Java is an object oriented language, so everything we create in Java is-an object.
Inheritance represents an is-a relationship with all parents, or specifically, ancestor classes. Since all classes in Java inherit, at the top of the tree, from a class called object, then we can honestly say that EVERY class we create is-an Object.
I just love the elegance of Java. It's everywhere, even in the little things like the Object class.
How about BaseClass? After all it is a class, not an object.
Still, it really doesn't matter why they named it Object.
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Joined: Jan 29, 2003
It is interesting that they didn't have to have a common ancestor to everything if they didn't want to. In a strongly typed language it's good to have a place like this to put useful behavior. Look at the methods on Object. Could they have implemented these some other way without a single ancestor?
Cameron Wallace McKenzie
author and cow tipper
Originally posted by Rusty Shackleford: How about BaseClass? After all it is a class, not an object.
Last time I checked, every class was a class, but its instances are objects, and classes tend to new named after their objects, not? Actually, if we are suggesting new names, I like "Om", the sound that created the universe. Why not say it now, "Ooommmm". Ah...