Class index (this_class) and the parent index (super_class) u2 is a type of data, and the interface index set (the interfaces) is a collection of data types u2, Class class file is determined by the data of the three inheritance.
- Class Index
Class index for determining the fully qualified name of the class.
- Parent index
Parent index for determining the fully qualified name of the parent class.
Since the Java language does not allow multiple inheritance, so the index is only one parent, in addition to java.lang.Object.
All java have a parent class, in addition to java.lang.Object, all of the parent index Java classes are different from zero.
- Interface index set
Interface index set is used to describe the class which implements the interface, these interfaces are implemented will implements statement (if class is an interface itself, should then extends clause) interface after the order from left to right in the interface index set if the class does not implement any interfaces, the counter is zero.
Class index, and an index set index parent class interfaces are sequentially arranged after the access flag, and parent class index for index
Two types of index values represents u2, each of which points to a type descriptor for the class often CONSTANT_Class_info
The amount, by the index value CONSTANT_Class_info type defined constants can be found in
CONSTANT_Utf8_info type constants fully qualified name string.
Case
public class TestConstant {
private final int a = 10;
private final int b = 10;
private int c = 11;
private int d = 11;
private long e = -11111110005514L;
private long f = -11111110005514L;
private double g = 10.4557848D;
private double h = 10.4557848D;
private String y = "JVM";
private String j = "JVM";
}
After compiled into class files, using UltraEdit open, it can be compiled Java bytecode
由此可以得知类索引为0x0011(对应的十进制值为17),父类索引是0x0012(对应的十进制值为18),接口索引0x0000(对应的十进制值为0,则就是没有)。
类索引和父类索引对应了第17和第18个常量池,得出类是TestConstant,父类是Object,(没有显式继承任何类,默认是继承Object父类)。