How to get a class by reflection in Java
•
Java
Reflection means that you can get all the information of a class, mainly including methods and attributes.
1. Obtaining a method includes obtaining the name of the method, the return type of the method, the access modifier of the method, and executing the method through reflection.
2. Get the attribute, including the name, type, access modifier and the value of the attribute.
These acquisitions have corresponding API operations.
The code is as follows:
The above content is how to reflect and obtain all the contents of a class in Java. I hope it will help you in your future study. At the same time, I also hope to learn and make progress with you.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码