ERROR - java.lang.NoSuchMethodException: Class.methodName (Parameter)


 java.lang.NoSuchMethodException: Class.methodName (Parameter)

at java.lang.Class.getMethod(

Error Type

Run Time

Sample Code

Method method = BuggyBreadClass.class.getMethod( "myMethod", String.class );


Method being referenced doesn't exist.


Make sure that the method being referenced should exist in the class. It should have the same name, should have the specified perimeter(s) and should have the adequate access.

In the above example - Make sure that myMethod exists in BuggyBreadClass and should take only one String argument and shouldn't be declared private.