The initialization here can be understood as the last step of class loading (calling the <clinit>),如果是两个不同的ClassLoad加载的话那么<clinit>会被执行两次,加载的Class对象在方法区(永久代),并且会对应两个Classobject.
If it is an overloaded findClass方法代码运行出来的结果最后应该是两个true.上述代码,因为class文件最终是在classpath下,所以都是交给AppLoader去加载,如果需要呈现效果,需要把class文件挪一个位置,挪到不在classpath.楼主是重载loadClassmethod
Simply put it is this:
For more information, just search the keyword "Parental Delegation Model" in the search engine.
Off topic, I think this code is very neat and looks very comfortable
The initialization here can be understood as the last step of class loading (calling the
<clinit>
),如果是两个不同的ClassLoad加载的话那么<clinit>
会被执行两次,加载的Class
对象在方法区(永久代),并且会对应两个Class
object.If it is an overloaded
findClass
方法代码运行出来的结果最后应该是两个true
.上述代码,因为class
文件最终是在classpath
下,所以都是交给AppLoader去加载,如果需要呈现效果,需要把class
文件挪一个位置,挪到不在classpath
.楼主是重载loadClass
method