Here you can find the source of newInstance(String className, Object... args)
public static Object newInstance(String className, Object... args) throws Exception
//package com.java2s; //License from project: Open Source License import java.lang.reflect.*; public class Main { public static Object newInstance(String className, Object... args) throws Exception { return newInstance(Class.forName(className), args); }// w w w .ja va 2s .com public static Object newInstance(Class<?> tClass, Object... args) throws Exception { Exception lastException = null; for (Constructor<?> constructor : tClass.getConstructors()) { try { return constructor.newInstance(args); } catch (Exception e) { lastException = e; } } throw lastException; } }