[Java] 什么是反射?

義往昔 2月前 ⋅ 208 阅读

https://www.52pojie.cn/thread-1074250-1-1.html

Reflection enables Java code to discover information about the fields, methods and constructors of loaded classes, and to use reflected fields, methods, and constructors to operate on their underlying counterparts, within security restrictions. The API accommodates applications that need access to either the public members of a target object (based on its runtime class) or the members declared by a given class. It also allows programs to suppress default reflective access control.

反射使 Java 代码可以发现有关已加载类的字段,方法和构造函数的信息,并在安全性限制内使用反射对这些字段,方法和构造函数进行操作。

 


全部评论: 0

    我有话说: