Java链接器如何工作? [英] How Java linker works?
问题描述
我想知道Java链接程序是如何工作的.具体来说,它将类,接口,包,方法等以何种顺序组合为jvm可执行格式.我在此处找到了一些信息,但事实并非如此.有关链接顺序的很多信息.
I want to know how Java linker works. Specifically, in which order it combines classes, interfaces, packages, methods and etc into jvm-executable format. I have found some information here, but there is not so much information about linking order.
推荐答案
没有Java链接器"之类的东西.但是,存在类加载器的概念,该类加载器给定"somewhere"中的java字节代码数组,可以创建类的内部表示形式,然后可以与new
等配合使用.
There is no such thing as a Java "linker". There is, however, the concept of a classloader which - given an array of java byte codes from "somewhere" - can create an internal representation of a Class which can then be used with new
etc.
在这种情况下,接口只是特殊的类.加载类后,即可使用方法和字段.
In this scenario interfaces are just special classes. Methods and fields are available when the class has been loaded.
这篇关于Java链接器如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!