Here you can find the source of getMethod(Class> clazz, String methodName, Class>... params)
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... params) throws NoSuchMethodException
//package com.java2s; import java.lang.reflect.Method; public class Main { public static Method getMethod(Class<?> clazz, String methodName, Class<?>... params) throws NoSuchMethodException { try {/*from w w w .ja v a 2 s.com*/ return clazz.getDeclaredMethod(methodName, params); } catch (NoSuchMethodException e) { Class<?> superClass = clazz.getSuperclass(); if (superClass == null) { throw e; } else { return getMethod(superClass, methodName, params); } } } }