Java class file: Difference between revisions

Content deleted Content added
Citation needed for a statement that seems to be wrong or outdated.
Tag: Reverted
cleared previously added "citation needed"
Line 261:
The constant pool table is where most of the literal constant values are stored. This includes values such as numbers of all sorts, strings, identifier names, references to classes and methods, and type descriptors. All indexes, or references, to specific constants in the constant pool table are given by 16-bit (type u2) numbers, where index value 1 refers to the first constant in the table (index value 0 is invalid).
 
Due to historic choices made during the file format development, the number of constants in the constant pool table is not actually the same as the constant pool count which precedes the table. First, the table is indexed starting at 1 (rather than 0), but the count should actually be interpreted as the maximum index plus one.<ref name="jvms-4.4">{{Cite web|url=https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.4|title=Chapter 4. The class File Format}}</ref> Additionally, two types of constants (longs and doubles) take up two consecutive slots in the table, although the second such slot is a phantom index that is never directly used.{{Citation needed|reason=Not according to the JVM Specification|date=August 2022}}
 
The type of each item (constant) in the constant pool is identified by an initial byte ''tag''. The number of bytes following this tag and their interpretation are then dependent upon the tag value. The valid constant types and their tag values are: