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 {
    /**
     * @param clz class name
     * @param methodName method name
     * @return true if the method is in the class, else false
     */
    public static Method getMethod(Class clz, String methodName, Class... parameterTypes) {
        if (null != clz) {
            try {
                return clz.getMethod(methodName, parameterTypes);
            } catch (Exception e) {
            }
            return (clz == Object.class ? null : getMethod(clz.getSuperclass(), methodName, parameterTypes));
        }
        return null;
    }
}