Java中的Object.getClass()
方法文档中写道:
Returns the runtime class of this
Object
. The returnedClass
object is the object that is locked bystatic synchronized
methods of the represented class. The actual result type isClass<? extends |X|>
where|X|
is the erasure of the static type of the expression on whichgetClass
is called. For example, no cast is required in this code fragment:
Number n = 0; Class<? extends Number> c = n.getClass();
Returns: The
Class
object that represents the runtime class of this object.
运行时类是什么?
“返回的Class
对象由static synchronized
方法锁定”的含义是什么?