package chapter03; //Java种的类主要分为3种 //1.Java核心类库种的类:String,0bject //2.JVM 软件平台开发商 //3.自己写的类,User,Child //类加载器也有3种 //1.BootclassLoader:启动类加载器 // 2.PlatformclassLoader:平台类加m载器 // 3. AppCLassLoader : public class Test05 { public static void main(String[] args) { Class<Students> studentsClass = Students.class; // 获取类的加载器对象 ClassLoader classLoader = studentsClass.getClassLoader(); System.out.println(classLoader); System.out.println(classLoader.getParent()); System.out.println(classLoader.getParent().getParent()); Class<String> stringClass = String.class; // 获取类的加载器对象 ClassLoader classLoader1 = stringClass.getClassLoader(); System.out.println(classLoader1); //加载核心类--》 平台类库--》自己类库 } } class Students { }
Java类的加载器
于 2024-02-15 11:27:14 首次发布