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
This is basically how it works. You type
Foo f = new Foo();
At this point the classloader will determine if Foo()
have been loaded viz its bits in memory/perm gen. If it has been loaded, then use that. Otherwise delegate it to the parent class loader to try to resolve the class. The bits of this class are read from disk then loaded into memory. On the next new Foo()
, the class would now be found in memory/loaded.