Here you can find the source of newInstance(Class> clazz)
@SuppressWarnings("unchecked") public static <T> T newInstance(Class<?> clazz)
//package com.java2s; public class Main { @SuppressWarnings("unchecked") public static <T> T newInstance(Class<?> clazz) { try {/*from w w w . ja v a 2 s . c om*/ return (T) clazz.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } @SuppressWarnings("unchecked") public static <T> T newInstance(String clazz) { try { return (T) Class.forName(clazz).newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }