- Notifications
You must be signed in to change notification settings - Fork 46.2k
类加载器一问的补充说明Java->JVM->6.类加载器 #871
Copy link
Copy link
Closed
Labels
enhancementNew feature or request or suggestionNew feature or request or suggestiontypoCorrect typosCorrect typos
Description
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request or suggestionNew feature or request or suggestiontypoCorrect typosCorrect typos
如果我们不想用双亲委派模型怎么办?
不想使用双亲委派模型,我们可以自定义自己的类加载器,需要继承
java.lang.ClassLoader,但是如果是要自定类加载器,也是需要继承ClassLoader,但是覆盖的是findClass方法,这点需要做下补充说明,这点看源码就可以确认,可以参考博客:https://blog.csdn.net/SEU_Calvin/article/details/52315125,因为最近面试经常被问到,之前被误导了,面试官反复确认,我还是说是重写`loadClass`方法,因而这点感觉需要做下补充说明。