Here you can find the source of getMethod(Class
static public <T> Method getMethod(Class<T> type, String methodName, Class<?>... params)
//package com.java2s; import java.lang.reflect.Method; public class Main { static public <T> Method getMethod(Class<T> type, String methodName, Class<?>... params) { if (type != null && methodName != null && methodName.length() > 0) { try { if (params != null && params.length > 0 && params[0] != null) { return type.getMethod(methodName, params); } else { return type.getMethod(methodName); }/*from w w w .j a va 2 s . c o m*/ } catch (NoSuchMethodException e) { } } return null; } }