When JVM requests for a class, it invokes ClassLoader.loadClass() method by passing the fully classified name of the Class.
public Class<?> loadClass(String name) throwsClassNotFoundException;
loadClass() method calls for findLoadedClass() method to check that the class has been already loaded or not. It’s required to avoid loading the class multiple times.
protected final Class<?> findLoadedClass(String name);
If the Class is not already loaded then it will delegate the request to parent ClassLoader to load the class.
If the parent ClassLoader is not finding the Class then it will invoke findClass() method to look for the classes in the file system.
protectedClass<?> findClass(String name) throwsClassNotFoundException;
No comments:
Post a Comment