关于java的类加载器
PHP中文网
PHP中文网 2017-04-18 10:20:06
0
2
341
public class Main {
    public static void main(String[] args) {
        System.out.println(String.class.getClassLoader());
        System.out.println(Main.class.getClassLoader());
    }
}

分别输出null和AppClassLoader,为什么String是null?自己写的类即classpath下的是通过AppClassLoader加载,jdk里的类是通过哪个加载器加载的?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
小葫芦

String’s class loader is bootstrap class loader. Class loading in this way will be displayed as null

刘奇

String is loaded by the bootstrap class loader, and 引导类加载器 is implemented in native C++ code and does not inherit from java.lang.ClassLoader. We cannot obtain this class loader in the program of.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!