Here you can find the source of invokeMethod(Method method, Object target, Object... args)
public static Object invokeMethod(Method method, Object target, Object... args)
//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(Method method, Object target, Object... args) { Object obj = null;/* w w w. j a va 2s . com*/ try { obj = method.invoke(target, args); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return obj; } }