question in reading java reflect

1. create the dynamic instance for what ?

 

  • for get the methods , fields ,constructors  ....

 

2. if the modifers of the method is private/protected , will the method be reflected ?

 

 

  • getMethod ---Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object.
  •        getDeclaredMethods ---Returns an array of Method objects reflecting all the methods declared by the class or interface represented by this Class object. This includes public, protected, default (package) access, and private methods, but excludes inherited methods.
  •  it is the same as to fileds 

 

3.what i learned since now :

 

  • what is reflect in java 
  • what can reflect do in java 
  • how to get an instance and the constructors ,methods ,fields through reflect to have a good knowledge of the class which been reflect .
  • advantage and disadvantage (low performance ,may be make the program more complex
  • example : dymaic invoke

 

4. java.lang.Array 类提供了动态创建和访问数组元素的各种静态方法

 

 

 

5.

 

article :

http://cache.baidu.com/c?m=9f65cb4a8c8507ed4fece7631046893b4c4380143fd3d1027fa3c215cc79010a0261e3b924211219839b21321cee0f0facab676f370324b79dcb824fddb990222488213f771f864613d212b2df037881769f18a9f45db4fca72593dfc5a3d84322cc44040a97808e4d7062dd1ff50342e9b19838022e16ad9b4172fe2960599a3430b05088eb25190196f7ad4b3dc33da463&p=cb74c54ad3c152f40be290264800&user=baidu&fm=sc&query=private+%B5%C4%B7%BD%B7%A8%C4%DC%B7%B4%C9%E4%C2%F0&qid=d0c30dfc12b5c43c&p1=1

你可能感兴趣的:(reflect)