Here you can find the source of newInstance(Class
public static <T> T newInstance(Class<T> cls) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException, InstantiationException
//package com.java2s; /*/*w ww.j a v a2 s.com*/ * Beanfabrics Framework Copyright (C) by Michael Karneim, beanfabrics.org * Use is subject to license terms. See license.txt. */ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class Main { public static <T> T newInstance(Class<T> cls) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException, InstantiationException { Constructor<T> constr = cls.getConstructor((Class[]) null); if (!constr.isAccessible()) { constr.setAccessible(true); } T result = constr.newInstance((Object[]) null); return result; } }