Load a class given its name.


import java.net.MalformedURLException;
import java.net.URL;

public class ClassUtils {
    public static Class loadClass(String className) throws ClassNotFoundException {
        return getClassLoader().loadClass(className);
    }
    public static URL getResource(String resource) throws MalformedURLException {
        return getClassLoader().getResource(resource);
    }

    public static ClassLoader getClassLoader() {
        return Thread.currentThread().getContextClassLoader();
    }
}
Home 
  Java Book 
    Runnable examples  

Reflection Class:
  1. Class modifier: public, abstract or final
  2. Class simple name plus package name
  3. Create new instance
  4. Class reflection, all methods, constructors, parameters, interfaces
  5. Get super class name
  6. Get the class By way of .class
  7. Get unqualified class Name
  8. Is Type Compatible
  9. Is Primitive type
  10. Load a class given its name.