When calling loadClass()
on a ClassLoader, does the ClassLoader
first check if the class has been loaded, or does it immediately delegate this check to
To concur with Sri's answer, it will always get delegated to the parent and the api is correct. If you are playing with classloading, this can make things a little tricky to get right, or achieve the effects you are after. I would suggest starting the jvm with a minimal classpath and then loading all classes using your custom classloader, the easiest way to do this is to use a URLClassloader or a composite object wrapping a URLClassloader so you would be able to trace which classes are loaded and when.
Also worth bearing in mind that a class A loaded by classloader C != class A loaded by classloader C if C and D are not part of the same classloader-parent-child hierarchy.