This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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. Regds. Rahul
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.