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 ? ? ? ? ? ? ? ? ? ? ? ?(在運(yùn)行時(shí))?
? ?判斷任意一個(gè)對(duì)象所屬的類;
? ?構(gòu)造任意一個(gè)類的對(duì)象;
? ?判斷任意一個(gè)類所具有的成員變量和方法;
? ?調(diào)用任意一個(gè)對(duì)象的方法;
? ?生成動(dòng)態(tài)代理。

3 steps the reflection do
4: talk about Classes
? ? ? In java,the object(對(duì)象)有兩種類型:引用類型和基本類型
引用類型 extends java.lang.Object
基本類型 ?boolean, byte, short, int, long ,double ,char ,float

理解 class 和 object
java reflection 允許在程序運(yùn)行時(shí)去獲取一個(gè)class(類)的成員變量和方法。
虛擬機(jī)在class文件的加載階段,把類信息保存在方法區(qū)數(shù)據(jù)結(jié)構(gòu)中,并在Java堆中生成一個(gè)Class對(duì)象,作為類信息的入口。

class對(duì)象