• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

object

 
catchbollu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats the problem? Object is in the java.lang package,
and is the superobject of everything. so?
Bill
 
Rahul Mahindrakar
Ranch Hand
Posts: 1868
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
john shen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic