Here you can find the source of newInstance(final Class
public static <T> T newInstance(final Class<T> clazz)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Constructor; public class Main { public static <T> T newInstance(final Class<T> clazz) { try {//from www . j a v a 2s . c o m final Constructor<T> constructor = clazz.getDeclaredConstructor(); constructor.setAccessible(true); return constructor.newInstance(); } catch (ReflectiveOperationException e) { throw new IllegalStateException(e); } } }