File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Why java.lang.Object is implicitely always extended? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why java.lang.Object is implicitely always extended?" Watch "Why java.lang.Object is implicitely always extended?" New topic
Author

Why java.lang.Object is implicitely always extended?

Anup Katariya
Greenhorn

Joined: Oct 23, 2002
Posts: 29
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?


SCJP
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10916
    
  12

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36486
    
  16
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

Joined: Oct 23, 2002
Posts: 29
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
 
subject: Why java.lang.Object is implicitely always extended?
 
Similar Threads
enum keyword
anonymous classes
Question on NotSerializableException
All Objects always extend "Object"
JTable set column data type