Returns the runtime class of this Object
. The returned
Class
object is the object that is locked by
static synchronized
methods of the represented class.
The actual result type is Class<? extends |X|>
where |X|
is the erasure of the static type of the
expression on which getClass
is called. For
example, no cast is required in this code fragment:
Number n = 0;
Class<? extends Number> c = n.getClass();
Class
object that represents the runtime
class of this object.
@jls 15.8.2 Class Literals
Diagram: Object