Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class Main {

    @SuppressWarnings("unchecked")
    public static Method getStaticMethod(Class clazz, String methodName, Class args[]) {
        try {
            Method method = clazz.getDeclaredMethod(methodName, args);
            if ((method.getModifiers() & Modifier.STATIC) != 0)
                return method;
        } catch (NoSuchMethodException ex) {
        }
        return null;
    }
}