Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    public static Method getMethod(Class<?> classObject, String methodName, Class... parametersType) {
        Class sCls = classObject.getSuperclass();

        while (sCls != Object.class) {
            try {
                return sCls.getDeclaredMethod(methodName, parametersType);
            } catch (NoSuchMethodException var5) {
                sCls = sCls.getSuperclass();
            }
        }

        throw new RuntimeException("Method not found " + methodName);
    }
}