Here you can find the source of newInstanceOf(String className)
public static Object newInstanceOf(String className) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, SecurityException
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class Main { public static Object newInstanceOf(String className) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, SecurityException { Class<?> c = Class.forName(className); Constructor<?> constructor = c.getConstructor(); return constructor.newInstance(); }/*from w w w .j a v a 2 s . co m*/ }