Here you can find the source of invokeMethod(Object object, Method method, Object... args)
public static Object invokeMethod(Object object, Method method, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { public static Object invokeMethod(Object object, Method method, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { method.setAccessible(true);//www .ja v a 2 s .co m return method.invoke(object, args); } }