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) { return newInstance(fetchClass(className)); }/*from w w w .ja va 2s .c om*/ public static <T> T newInstance(Class<T> clazz) { if (clazz == null) { return null; } try { return clazz.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; } public static Class<?> fetchClass(String className) { try { return Class.forName(className); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; } }