字符串.class从哪个类装入器装入


package com.ajay.test;
public class ClassLoaderDemo {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println(String.class.getClassLoader());
        System.out.println(ClassLoaderDemo.class.getClassLoader());
    }
}

输出

null
sun.misc.Launcher$AppClassLoader@73d16e93

为什么我得到字符串.class.getClassLoader((为空?

请参阅文档:

public ClassLoader

getClassLoader((

返回类的类装入器。某些实现可能会使用null 表示引导类装入器。此方法将返回如果此类由引导程序加载,则在此类实现中为 null类装入器。

最新更新