• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why is the superclass named as 'Object'

 
Vijay Gopinath
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

TIA,
Vijay
 
Campbell Ritchie
Sheriff
Pie
Posts: 49813
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always thought that in object-oriented programming all objects are objects so you call them Object . . .
 
Sanjaya Sugiarto
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be a better name in OO-language that the superclass called Object?
Interesting question, for exact answer you should ask James Gosling though.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not all OO languages have a single common superclass of all objects, but where they do so, "Object" seems a pretty good name for it!
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Objects will be Objects.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty sure if I invented an OO language with a single ancestor at the top, I'd call it BOB. The framework I use has BOB-Objects and that just makes me very happy. Yup, BOB.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BOB, would probably raise the ire of Microsoft (although they might be trying to forget all about BOB, who knows?), so I'd probably choose Fred.
 
Henry Wong
author
Marshal
Pie
Posts: 21423
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Microsoft BOB... now that was a cool name for a product.

What did it do again? ...

Henry
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MS BOB was a competitor to IBM TopView wasn't it?
 
Manoj Kumar Ravikanti
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by marc weber:
Objects will be Objects.


Objects will not be Objects (all the time).
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
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
Originally posted by Vijay Gopinath:
It could be anything else


"Object" seems the most logical to me. Are there other possibilities that make more sense to you?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm torn between Doohickey and Thingamajig.
 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about BaseClass? After all it is a class, not an object.


Still, it really doesn't matter why they named it Object.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about extending from a common class called Problem.

Then we could say: everything we code in Java is-a Problem

What else? Nuisance? ThingForSomeoneElseToDO? Challenge?
 
Dana Bothner-By
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic