Here you can find the source of newInstance(String name, ClassLoader loader)
public static Object newInstance(String name, ClassLoader loader)
//package com.java2s; //License from project: Apache License public class Main { public static Object newInstance(String name) { return newInstance(forName(name)); }//from w ww . j a v a 2 s.c om public static Object newInstance(String name, ClassLoader loader) { return newInstance(forName(name, loader)); } public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } } public static Class<?> forName(String name) { return forName(name, null); } public static Class<?> forName(String name, ClassLoader loader) { try { if (loader == null) { return Class.forName(name); } return Class.forName(name, true, loader); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }