Here you can find the source of getMethod(Class> theClass, String methodName, Class>[] paramTypes)
public static Method getMethod(Class<?> theClass, String methodName, Class<?>[] paramTypes)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { public static Method getMethod(Class<?> theClass, String methodName, Class<?>[] paramTypes) { Method method = null;/*w w w. j a v a2 s . c o m*/ try { method = theClass.getDeclaredMethod(methodName, paramTypes); method.setAccessible(true); } catch (NoSuchMethodException | SecurityException e) { } if (method == null) { Class<?> superClasss = theClass.getSuperclass(); if (superClasss != null) method = getMethod(superClasss, methodName, paramTypes); } return method; } }