This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why java.lang.Object is implicitely always extended?

 
Anup Katariya
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We all know that the java.lang.Object is always implicitly extended. But why java makers decided to do that. I mean I dont think c++ or any other oo language implicitly extends some base object.

Could we have done creating objects without extending to java.lang.Object?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12021
25
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could we have done creating objects without extending to java.lang.Object?


You answered your own question - like you said, C++ does not have every class extend a base object.

Why is it this way in Java? you could easily ask "why isn't it this way in C++?" The designers of the languages felt that, when you weigh all the options, the balance fell one way or the other.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47270
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the OO languages I have used all have a single superclass; Java and C# use "Object" and Eiffel uses "Any" which itself inherits from "General."
 
Anup Katariya
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply. Just confirmed my understanding that it is a better thing to do.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic