Home >Java >javaTutorial >How to call method in java reflection
1. Description
Ordinary methods in a class can only be called after the class instantiates an object. There are three instantiation methods (new, conle, reflection).
2. Instance
public class Book { private String title; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }
The class has a no-argument constructor, so when instantiating an object, you can directly use the newInstance method provided by Class.
1. Simple. As long as you understand the basic concepts, you can write applications suitable for various situations;
2. Object-oriented ;
3. Distribution, Java is a network-oriented language;
4. Robustness, Java provides automatic garbage collection for memory management, preventing programmers from easily generating errors when managing memory. Error;
5. Security, Java used in network and distributed environments must prevent virus intrusion;
6. Architecture neutrality, as long as the Java runtime system is installed, Can run on any processor;
7. Portability, Java can be easily transplanted to different machines on the network;
8. Interpretation and execution, the Java interpreter directly interprets Java words Section code is interpreted and executed.
The above is the detailed content of How to call method in java reflection. For more information, please follow other related articles on the PHP Chinese website!