getDeclaredMethods和getMethods的区别

[getDeclaredMethods](http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getDeclaredMethods)
Returns an array of Method
objects reflecting all the methods declared by the class or interface represented by this Class object.
[getMethods]
(http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getMethods)
Returns an array containing Method
objects reflecting all the public member 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.
getDeclaredMethod()获取的是类自身声明的所有方法,包含public、protected和private方法。
getMethod()获取的是类的所有共有方法,这就包括自身的所有public方法,和从基类继承的、从接口实现的所有public方法。
【getDeclaredMethods和getMethods的区别】也就说调用getMethods方法输出的是自身的public方法和父类Object的public方法。调用getDeclaredMethods方法输出的是自身的public、protected、private方法。

    推荐阅读