Results 1 to 3 of 3
  1. #1
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    7

    Default Relationship between Object, Class, classes in Java API, and those that we design?

    What is the relationship between the Object class, the Class class (whose instance we get by calling getClass() from our classes), and the classes we design?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Relationship between Object, Class, classes in Java API, and those that we design

    The Object class is, as we all know, the mother of all classes; it's the only class that doesn't have a parent class. An object of the Class class, represents a class, e.g. a Class<String> object represents the String class; it's the entry point to reflection. Through a Class object, you can find everything about the class represented by the Class object. There is no difference between the classes described in the API and your own classes.

    To confuse you even more: think of what an object of the class Class<Class> represents ... ;-)

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    7

    Default Re: Relationship between Object, Class, classes in Java API, and those that we design

    To confuse you even more: think of what an object of the class Class<Class> represents ... ;-)
    I think an object of Class<Class> would represent the Class class, which in turn represents any/every class. So basically an object of Class<Class> would represent any of the classes in the universal set of classes?

Similar Threads

  1. Replies: 9
    Last Post: 03-02-2016, 04:42 PM
  2. Class/Object/Program Design Conceptualization
    By iLikeStrongJava in forum New To Java
    Replies: 3
    Last Post: 06-14-2012, 09:55 PM
  3. relationship between classes
    By talia in forum New To Java
    Replies: 1
    Last Post: 12-10-2011, 03:33 PM
  4. class relationship
    By RajShri in forum New To Java
    Replies: 2
    Last Post: 01-04-2010, 05:54 AM
  5. What is this Object relationship?
    By SirRawlins in forum New To Java
    Replies: 3
    Last Post: 12-14-2007, 03:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •