---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 8 Edition"
java_version: 8
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/se8/html/jvms-4.html#jvms-4.4
id: "4.4"
url: https://jvm.obfuscated.software/jvms/se8/4.4.html
raw: https://jvm.obfuscated.software/jvms/se8/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 item in the `constant_pool` table must begin with a 1-byte tag indicating the kind of `cp_info` entry. The contents of the `info` array vary with the value of `tag`. The valid tags and their values are listed in Table 4.4-A. Each tag byte must be followed by two or more bytes giving information about the specific constant. The format of the additional information varies with the tag value.

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

| Constant Type | Value |
|---|---|
| `CONSTANT_Class` | 7 |
| `CONSTANT_Fieldref` | 9 |
| `CONSTANT_Methodref` | 10 |
| `CONSTANT_InterfaceMethodref` | 11 |
| `CONSTANT_String` | 8 |
| `CONSTANT_Integer` | 3 |
| `CONSTANT_Float` | 4 |
| `CONSTANT_Long` | 5 |
| `CONSTANT_Double` | 6 |
| `CONSTANT_NameAndType` | 12 |
| `CONSTANT_Utf8` | 1 |
| `CONSTANT_MethodHandle` | 15 |
| `CONSTANT_MethodType` | 16 |
| `CONSTANT_InvokeDynamic` | 18 |

**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)
