Method object that reflects the specified public
member method of the class or interface represented by this
Class object. The
name parameter is a
String specifying the simple name of the desired method. The
parameterTypes parameter is an array of
objects that identify the method's formal parameter types, in declared
null, it is
treated as if it were an empty array.
Class object represents an array type, then this
method finds any public method inherited by the array type from
Object except method
Class object represents an interface then this
method does not find any implicitly declared method from
Object. Therefore, if no methods are explicitly declared in
this interface or any of its superinterfaces, then this method does not
find any method.
This method does not find any method with name "
Generally, the method to be reflected is determined by the 4 step
algorithm that follows.
Let C be the class or interface represented by this
getDeclaredMethods()and filtered to include only public methods that match given
Object, then include the result of invoking this algorithm recursively on the superclass of C.
|the name of the method|
|the list of parameters|
Method object that matches the specified
|if a matching method is not found or if the name is "<init>"or "<clinit>".|
| if |
| If a security manager, s, is present and
the caller's class loader is not the same as or an
ancestor of the class loader for the current class and
invocation of |
@apiNote There may be more than one method with matching name and
parameter types in a class because while the Java language forbids a
class to declare multiple methods with the same signature but different
return types, the Java virtual machine does not. This
increased flexibility in the virtual machine can be used to
implement various language features. For example, covariant
returns can be implemented with bridge methods; the bridge
method and the overriding method would have the same
signature but different return types. This method would return the
overriding method as it would have a more specific return type.
@jls 8.2 Class Members
@jls 8.4 Method Declarations