Here you can find the source of newInstance(Constructor> constructor, Object... args)
private static Object newInstance(Constructor<?> constructor, Object... args)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class Main { private static Object newInstance(Constructor<?> constructor, Object... args) { try {// w w w . ja va2s. co m return constructor.newInstance(args); } catch (InstantiationException e) { throw new IllegalArgumentException("Can't instantiate " + constructor, e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Can't instantiate " + constructor, e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("Can't instantiate " + constructor, e); } } }