If I say System.out.println(Object.class), I get as output the toString method of the Class class. Is there a hidden field class of type Class in Object? Because in JDK documentation I do not see any field in Object.
Hello Carlo Object.class is a class literal. This is from JLS
15.8.2 Class Literals A class literal is an expression consisting of the name of a class, interface, array, or primitive type followed by a `.' and the token class. The type of a class literal is Class. It evaluates to the Class object for the named type (or for void) as defined by the defining class loader of the class of the current instance.
Also the wrappers clases and java.lang.Void class have a TYPE field containing a Class object for the corresponding type: Integer.TYPE <==> Integer.class ... Void.TYPE <==> Void.class
I am sorry I did a mistake in my previous answer. The fields Integer.TYPE ... Void.TYPE holds references to int.class ... void.class objects. Integer.class represents the Class object for java.lang.Integer class. Also Void.class is a class literal for java.lang.Void