---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 10 Edition"
java_version: 10
chapter: "Chapter 4. The class File Format"
section: "4.4"
heading: "4.4. The Constant Pool"
parent: "Chapter 4. The class File Format"
source: https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.4
id: "4.4"
url: https://jvm.obfuscated.software/jvms/se10/4.4.html
raw: https://jvm.obfuscated.software/jvms/se10/4.4.md
---

# 4.4. The Constant Pool

Java Virtual Machine instructions do not rely on the run-time layout of classes, interfaces, class instances, or arrays. Instead, instructions refer to symbolic information in the `constant_pool` table.

All `constant_pool` table entries have the following general format:

```
cp_info {
    u1 tag;
    u1 info[];
}
```

Each entry in the `constant_pool` table must begin with a 1-byte tag indicating the type of constant denoted by the entry. The constant types and their corresponding tag values are listed in Table 4.4-A. Each constant type is accompanied by the first version of the `class` file format in which it was defined, and the corresponding version of the Java SE Platform. (For old `class` file versions, the JDK release is used instead of the Java SE Platform version.)

Each tag byte must be followed by two or more bytes giving information about the specific constant. The format of the additional information depends on the tag byte, that is, the content of the `info` array varies with the value of `tag`.

**Table 4.4-A. Constant pool tags**

| Constant Type | Value | `class` file | Java SE |
|---|---|---|---|
| `CONSTANT_Class` | 7 | 45.3 | 1.0.2 |
| `CONSTANT_Fieldref` | 9 | 45.3 | 1.0.2 |
| `CONSTANT_Methodref` | 10 | 45.3 | 1.0.2 |
| `CONSTANT_InterfaceMethodref` | 11 | 45.3 | 1.0.2 |
| `CONSTANT_String` | 8 | 45.3 | 1.0.2 |
| `CONSTANT_Integer` | 3 | 45.3 | 1.0.2 |
| `CONSTANT_Float` | 4 | 45.3 | 1.0.2 |
| `CONSTANT_Long` | 5 | 45.3 | 1.0.2 |
| `CONSTANT_Double` | 6 | 45.3 | 1.0.2 |
| `CONSTANT_NameAndType` | 12 | 45.3 | 1.0.2 |
| `CONSTANT_Utf8` | 1 | 45.3 | 1.0.2 |
| `CONSTANT_MethodHandle` | 15 | 51.0 | 7 |
| `CONSTANT_MethodType` | 16 | 51.0 | 7 |
| `CONSTANT_InvokeDynamic` | 18 | 51.0 | 7 |
| `CONSTANT_Module` | 19 | 53.0 | 9 |
| `CONSTANT_Package` | 20 | 53.0 | 9 |

**Sections:**

- [4.4.1. The CONSTANT_Class_info Structure](4.4.1.md)
- [4.4.2. The CONSTANT_Fieldref_info, CONSTANT_Methodref_info, and CONSTANT_InterfaceMethodref_info Structures](4.4.2.md)
- [4.4.3. The CONSTANT_String_info Structure](4.4.3.md)
- [4.4.4. The CONSTANT_Integer_info and CONSTANT_Float_info Structures](4.4.4.md)
- [4.4.5. The CONSTANT_Long_info and CONSTANT_Double_info Structures](4.4.5.md)
- [4.4.6. The CONSTANT_NameAndType_info Structure](4.4.6.md)
- [4.4.7. The CONSTANT_Utf8_info Structure](4.4.7.md)
- [4.4.8. The CONSTANT_MethodHandle_info Structure](4.4.8.md)
- [4.4.9. The CONSTANT_MethodType_info Structure](4.4.9.md)
- [4.4.10. The CONSTANT_InvokeDynamic_info Structure](4.4.10.md)
- [4.4.11. The CONSTANT_Module_info Structure](4.4.11.md)
- [4.4.12. The CONSTANT_Package_info Structure](4.4.12.md)
