Class Loaders
i)Boot Strap Class Loader – load the java runtime classes(java.lang.ClassLoader)
ii)Extension Class Loader – loads the classes from the java.ext.dirs path (from .jar files) [ExtClassLoader]
iii)AppClassLoader – loads all the classes from the class path
All class loaders except the bootstrap class loader have a parent class loader. Moreover, all class loaders are of the type java.lang.ClassLoader
If a class (say Target.class) is loaded by 2 ClassLoaders separately and independently then types of both the classes(althought Target.class) will not be type compatible.
Target t1 = (Target) t2 will throw ClassCastException; where t1 and t2 are instantiated using different class loaders.This is because JVM treats 2 classes as
different types
Source : On Java
Thursday, April 10, 2008
Subscribe to:
Posts (Atom)