Results 1 to 9 of 9
Like Tree2Likes
  • 1 Post By masijade
  • 1 Post By JosAH

Thread: What is a Class object, not the class named "Object"

  1. #1
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    116
    Rep Power
    0

    Default What is a Class object, not the class named "Object"

    This statement is given here.

    "You might wonder what happens when a static synchronized method is invoked, since a static method is associated with a class, not an object. In this case, the thread acquires the intrinsic lock for the Class object associated with the class. "

    What is a Class object associated with a class. Google search rather finds material about the Object class. I'm sure it is not that.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: What is a Class object, not the class named "Object"

    Class is a class like every other. Whenever a new class is loaded (i.e. referenced for the first time in a program) the Class class, defining the class itself, is instantiated, before instantiating any instances of the what the class defines. All static items are referenced from this instance of Class.
    Zarah likes this.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,105
    Rep Power
    6

    Default Re: What is a Class object, not the class named "Object"

    Quote Originally Posted by masijade View Post
    before instantiating any instances of the what the class defines.
    Say what?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,663
    Blog Entries
    7
    Rep Power
    21

    Default Re: What is a Class object, not the class named "Object"

    Quote Originally Posted by masijade View Post
    Class is a class like every other. Whenever a new class is loaded (i.e. referenced for the first time in a program) the Class class, defining the class itself, is instantiated, before instantiating any instances of the what the class defines. All static items are referenced from this instance of Class.
    That's why I dislike the name 'Object'; i.e. a Class object represents a class, but an Object doesn't represent any object; I vote for the new name 'InvisibleCosmicFlyingSpaghettiMonster'.

    kind regards,

    Jos ;-)
    masijade likes this.
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    116
    Rep Power
    0

    Default Re: What is a Class object, not the class named "Object"

    @masijade Thank you very much.

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,105
    Rep Power
    6

    Default Re: What is a Class object, not the class named "Object"

    Quote Originally Posted by JosAH View Post
    but an Object doesn't represent any object
    I like to be able to say that any object "is-an Object" myself. Being able to say that any object "is-an InvisibleCosmicFlyingSpaghettiMonster" would be funny the first 100 times but then it gets old.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: What is a Class object, not the class named "Object"

    Quote Originally Posted by gimbal2 View Post
    I like to be able to say that any object "is-an Object" myself. Being able to say that any object "is-an InvisibleCosmicFlyingSpaghettiMonster" would be funny the first 100 times but then it gets old.
    Never mind the extra typing involved, though I expect it would quickly get abbreviated to ICFSM.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,105
    Rep Power
    6

    Default Re: What is a Class object, not the class named "Object"

    I think it would just get shortened to 'Monster' myself.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    1

    Default Re: What is a Class object, not the class named "Object"

    Further reading for Zarah on the Class object:

    You know you've sorted this out when you know the differences between a Class class, Class object, Object class and Object object. ;-) (Hmm... looks like a good interview question...)

Similar Threads

  1. Class "object cannot be resolves to a type"
    By Bitterguy in forum New To Java
    Replies: 6
    Last Post: 08-23-2012, 03:23 PM
  2. Replies: 6
    Last Post: 02-08-2012, 07:42 PM
  3. Replies: 3
    Last Post: 05-02-2011, 05:37 AM
  4. How to inherit "Object" class in Java
    By Ipsita in forum Advanced Java
    Replies: 5
    Last Post: 04-08-2011, 01:37 PM
  5. lock on ".class" object
    By rajinder5 in forum Threads and Synchronization
    Replies: 0
    Last Post: 10-11-2010, 05:38 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
  •