1. Reflection
The Reflection library (Reflection Library) provides a rich set of tools for writing programs that dynamically manipulate Java code . This feature is
A large number of applications are in JavaBeans, which is the architecture of Java components.
A program capable of analyzing class capabilities is called reflection (Reflection), which means that a class (or base data type) can be manipulated as an object .
It is the structure and behavior of the runtime to detect and modify an object, unlike introspection (introspection). Introspection is a subset of reflection.
Reflection: Used to detect and modify the structure and behavior of an object at run time.
Introspection: Used to detect the type of an object and the properties it contains at run time.
Introspection instance: Object name instanceof class name/interface name;//Detect if an object belongs to a class or interface
Reflection instance: the Class.forName () method can get a class.
2.Class class
A class object actually represents a type , which is not necessarily a class, because it can also represent a basic data type.
It can use everything in Java (classes, interfaces, arrays, basic data types, void) as an object to access its properties.
java-reflection mechanism