Nick Widelec wrote:I can't quite grasp the concept of the Class object associated wit the class.
Could anybody ,who is able to, explain it to me in other words? thanks a lot in advance?
Class object? So far I knew a class is a class an object is a class instance.
There is a class called java.lang.Class. A Class object (an instance of java.lang.Class) represents metadata about a given class, such as its name, the names and types of its member variables, the signatures of its methods, etc. It can be referred to statically like
TheClassName.class (this is called a
class literal, or it can be retrieved dynamically from a reference with the
getClass() method. Class objects are used heavily in reflection.
As far as synchronization and locking is concerned (in fact as far as most things are concerned), it's just another object, and obtaining its lock has precisely the same effect as obtaining any other object's lock. What that quote is telling you is this: