[Java Basics] Reflection

For every type of object, the Java virtual machine instantiates an immutable instance of java.lang.Class which provides methods to examine the runtime properties of the object including its members and type information. Class also provides the ability to create new classes and objects. Most importantly, it is the entry point for all of the Reflection APIs.

对于ref object,可以call Object.getClass()来获取Class。

对于primitive,可以call boolean.class。

原文地址:https://www.cnblogs.com/chayu3/p/3911469.html