• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why is the superclass named as 'Object'

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I always thought that in object-oriented programming all objects are objects so you call them Object . . .
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Objects will be Objects.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MS BOB was a competitor to IBM TopView wasn't it?
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by marc weber:
Objects will be Objects.



Objects will not be Objects (all the time).
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm torn between Doohickey and Thingamajig.
 
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
reply
    Bookmark Topic Watch Topic
  • New Topic