JAVA类装载的三个基本原则

1.       委托原则:当加载一个类时,首先会委托父加载器来加载

2.       可视化原则:子类加载器能看到父类加载器加载的所有类,但是反过来是不行的。同时,兄弟类加载器也看不到对方加载的类

3.       唯一性原则:如果一个类加载器加载了某个类,那么它的子类加载器是不会再加载该类了的。

Delegation Principle: If a class is not loaded already, the classloaders delegate the request to load that class to their parent classloaders.

Visibility Principle: Classes loaded by parent classloaders are visible to child classloaders but not vice versa.

Uniqueness Principle: When a classloader loads a class, the child classloaders in the hierarchy will never reload that class.

参考: http://www.objectsource.com/j2eechapters/Ch21-ClassLoaders_and_J2EE.htm


你可能感兴趣的:(Java,java,classloader,class)