What is reflection?
Java's reflection mechanism means that in the running state of the program, you can construct an object of any class, you can understand the class to which any object belongs, and you can understand the member variables and methods of any class. Properties and methods of any object can be called. This function of dynamically obtaining program information and dynamically calling objects is called the reflection mechanism of the Java language.
Reflection is considered the key to dynamic languages.
(Video tutorial recommendation: java video)
The role of java reflection:
1. Determine the class to which any object belongs at runtime;
2. Construct an object of any class at runtime;
3. Determine the member variables and methods of any class at runtime;
4. Call the method of any object at runtime;
5. Generate a dynamic proxy.
Recommended tutorial: java entry program
The above is the detailed content of What is the role of java reflection. For more information, please follow other related articles on the PHP Chinese website!