1. Why do we need the java reflection?
Answer: to discover the information about an object at the runtime.so it is a dyamic mechansim.
2. Wiki says the reflection is:
the program observe itself,modifies itself structure and action(行为).
3. what can reflection can do at the runtime (在运行时)?
判断任意一个对象所属的类;
构造任意一个类的对象;
判断任意一个类所具有的成员变量和方法;
调用任意一个对象的方法;
生成动态代理。
3 steps the reflection do
4: talk about Classes
In java,the object(对象)有两种类型:引用类型和基本类型
引用类型 extends java.lang.Object
基本类型 boolean, byte, short, int, long ,double ,char ,float
理解 class 和 object
java reflection 允许在程序运行时去获取一个class(类)的成员变量和方法。
虚拟机在class文件的加载阶段,把类信息保存在方法区数据结构中,并在Java堆中生成一个Class对象,作为类信息的入口。
class对象