public class Test {
public static void main(String[] args) throws ClassNotFoundException {
//获取系统类的加载类
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
System.out.println(systemClassLoader);
//获取系统类加载器的父类加载器-->扩展加载器
ClassLoader parent = systemClassLoader.getParent();
System.out.println(parent);
//获取扩展类加载器的父类-->根加载器(c/c++)
ClassLoader parent1 = parent.getParent();
System.out.println(parent1);
//测试当前类是哪个加载器加载的
ClassLoader aClass = Class.forName("lesson02.Test").getClassLoader();
System.out.println(aClass);
//测试JDK内置的类是谁加载的
aClass = Class.forName("java.lang.Object").getClassLoader();
System.out.println(aClass);
//如何获得系统类加载器可以加载的路径
System.out.println(System.getProperty("java.class.path"));
//双亲委派机制
//java.lang.String
}
}