getMethods 和 getDeclaredMethods
getMethods和getDeclaredMethods的区别
getMethods
public Method[] getMethods()
throws SecurityException
Returns an array containing Method objects reflecting all the public methods of the class or interface represented by this Class object, including those declared by the class or interface and those inherited from superclasses and superinterfaces.
getDeclaredMethods
public Method[] getDeclaredMethods()
throws SecurityException
Returns an array containing Method objects reflecting all the declared methods of the class or interface represented by this Class object, including public, protected, default (package) access, and private methods, but excluding inherited methods.
备注
下面反射方法类似。
getDeclaredFields 和 getFields
getDeclaredField 和 getField
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 石头记!