Here you can find the source of invokeConstructor(Class
public static <T> T invokeConstructor(Class<T> clazz, Class<?>[] argTypes, Object[] args) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
//package com.java2s; //License from project: Apache License import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class Main { public static <T> T invokeConstructor(Class<T> clazz, Class<?>[] argTypes, Object[] args) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Constructor<T> constructor = clazz.getConstructor(argTypes); return constructor.newInstance(args); }//from w ww . java 2 s . co m }