标签:无法 null string 通过 while 实例 编译 str system
好程序员Java学习路线分享Java面试题之加载机制,面试场景:public class ClassLoaderTest {
    public static void main(String[] args) throws ClassNotFoundException {
        Class<?> clazz = Class.forName("com.qianfeng.thread.client.Programmer");
        ClassLoader classLoader = clazz.getClassLoader();
        System.out.println(classLoader.getClass().getSimpleName());
    }
}案例2:打印其双亲类加载器信息
while(classLoader.getParent() != null){
       classLoader = classLoader.getParent();
       System.out.println("-->"+classLoader.getClass().getSimpleName());
}标签:无法 null string 通过 while 实例 编译 str system
原文地址:https://blog.51cto.com/14479068/2439563