Here you can find the source of newInstance(Class
static <T> T newInstance(Class<T> clazz, Class<?>[] parameterTypes, Object[] initargs) throws InvocationTargetException
//package com.java2s; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class Main { static <T> T newInstance(Class<T> clazz, Class<?>[] parameterTypes, Object[] initargs) throws InvocationTargetException { try {/*from w w w.j a va 2 s . co m*/ Constructor<T> c = clazz.getDeclaredConstructor(parameterTypes); c.setAccessible(true); return c.newInstance(initargs); } catch (SecurityException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }