Skip to content

类加载器一问的补充说明Java->JVM->6.类加载器 #871

@ZerahMu

Description

@ZerahMu

如果我们不想用双亲委派模型怎么办?
不想使用双亲委派模型,我们可以自定义自己的类加载器,需要继承 java.lang.ClassLoader,但是如果是要自定类加载器,也是需要继承ClassLoader,但是覆盖的是findClass方法,这点需要做下补充说明,这点看源码就可以确认,可以参考博客:https://blog.csdn.net/SEU_Calvin/article/details/52315125,因为最近面试经常被问到,之前被误导了,面试官反复确认,我还是说是重写`loadClass`方法,因而这点感觉需要做下补充说明。

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request or suggestiontypoCorrect typos

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions