Abstract
Class loaders, and related parent delegation models, namespaces, runtime packages and other concepts, and also discuss some in-learning Issues that are easily confused.
public class LoaderSample1 {
public static void main(String[] args) {
Class c;
ClassLoader cl; cl = ClassLoader.getSystemClassLoader();
System.out.PRintln(cl); while (cl != null) {
cl = cl.getParent();
System.out.println(cl);
}
c = Class.forName("java.lang.Object");
cl = c.getClassLoader(); System.out.println("java.lang.Object's loader is " + cl); cl = Class.forName ("LoaderSample1");
cl = c.getClassLoader();
System.out.println("LoaderSample1's loader is " + cl);
("Loader "LoaderSample1; e.printStackTrace();
}
}
}
The above is the content of Java class loader and namespace. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!