Here you can find the source of forName(String className)
@SuppressWarnings("unchecked") public static <T> Class<T> forName(String className)
//package com.java2s; //License from project: Apache License public class Main { @SuppressWarnings("unchecked") public static <T> Class<T> forName(String className) { try {/*from w w w . j a v a2 s . co m*/ return (Class<T>) Class.forName(className); } catch (ClassNotFoundException e) { throw new RuntimeException(className, e); } } @SuppressWarnings("unchecked") public static <T> Class<T> forName(String className, boolean initialize, ClassLoader loader) { try { return (Class<T>) Class.forName(className, initialize, loader); } catch (ClassNotFoundException e) { throw new RuntimeException(className, e); } } }