本文共 524 字,大约阅读时间需要 1 分钟。
在父亲委托机制中,各个加载器按照父子关系形成了树型结构,除了根类加载器之外,其余的类加载器都有且只有一个父加载器
加载顺序:自底向上检查类是否已经加载,从顶向下尝试加载类
/* * Copyright (c) 2019 maoyan.com * All rights reserved. * *//** * 在这里编写类的功能描述 * * @author wangkai * @created 2019/12/31 */public class MyTest6 { public static void main(String[] args) throws Exception{ Class clazz=Class.forName("java.lang.String"); System.out.println(clazz.getClassLoader()); Class class1=Class.forName("C"); System.out.println(class1.getClassLoader()); }}class C{ }
转载地址:http://oobjn.baihongyu.com/