Java tutorial
//package com.java2s; public class Main { public static Class getDeclaredMethodClass(Class clazz, String methodName, Class... params) { do { try { clazz.getDeclaredMethod(methodName, params); return clazz; } catch (NoSuchMethodException e) { clazz = clazz.getSuperclass(); if (clazz == null) { return null; } } } while (true); } }