在 javap -verbose 之后,缺少一个常量池项
After javap -verbose, one constant pool item is missing
我创建了一个Java class 命名为JVMClassTest 然后编译。之后我运行"javap -verbose JVMClassTest".常量池的#4在哪里
public class JVMClassTest {
private int i = 0;
private static String s = "tString";
private final double d = 1.2d;
public JVMClassTest() {
}
public int getI() {
return i;
}
public static String getS() {
return s;
}
public double getD() {
return d;
}
}
下面是结果截图
根据 JVM specification on the classfile format:
The CONSTANT_Long_info and CONSTANT_Double_info represent 8-byte numeric (long and double) constants:
...
All 8-byte constants take up two entries in the constant_pool table of the class file. If a CONSTANT_Long_info or CONSTANT_Double_info structure is the item in the constant_pool table at index n, then the next usable item in the pool is located at index n+2.
我创建了一个Java class 命名为JVMClassTest 然后编译。之后我运行"javap -verbose JVMClassTest".常量池的#4在哪里
public class JVMClassTest {
private int i = 0;
private static String s = "tString";
private final double d = 1.2d;
public JVMClassTest() {
}
public int getI() {
return i;
}
public static String getS() {
return s;
}
public double getD() {
return d;
}
}
下面是结果截图
根据 JVM specification on the classfile format:
The CONSTANT_Long_info and CONSTANT_Double_info represent 8-byte numeric (long and double) constants:
...
All 8-byte constants take up two entries in the constant_pool table of the class file. If a CONSTANT_Long_info or CONSTANT_Double_info structure is the item in the constant_pool table at index n, then the next usable item in the pool is located at index n+2.