This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "object" Watch "object" New topic



Joined: Jul 27, 2000
Posts: 5
when i am going through java.lang pck,i saw the classes mentioned under this pck,i found that object is one class under this pck, but i also knew that object class is the superclass of all classes. how is this possible

catchbollu entered in
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
Whats the problem? Object is in the java.lang package,
and is the superobject of everything. so?
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1849
hi bollu,
The API has the specifications for all the classes. Object is a class in the end. It is also the superclass for all classes. The API must specify Objects constructor, methods, etc. This it does in the java.lang package which is available to all programes by default.
john shen

Joined: Jul 23, 2000
Posts: 14
i think the confusion is between package hierarchy and object hierarchy, which has little to do with each other, but the asker thought they are related.
there are questions on mocks that try to confuse you about them (e.g., what is the superclass of awt event classes? surely it is not in the java.awt!) therefore the confused feeling is legit, esp. when the java designers seem to be placing related classes randomly in unrelated packages. at least some of the time.
I agree. Here's the link:
subject: object
Similar Threads
MS-Word 2007
protected access
using a static function in XSL
ClassNotFoundException while using Class.forName to load a class dynamically
JMock Classes without a setter