Here you can find the source of newInstance(String className)
public static Object newInstance(String className)
//package com.java2s; //License from project: Apache License public class Main { public static Object newInstance(String className) { try {/*from www .j a v a 2 s. co m*/ return Class.forName(className).newInstance(); } catch (Exception e) { throw new RuntimeException("new instance fail : " + e.getMessage(), e); } } }