---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 13 Edition"
java_version: 13
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.ldc"
heading: "ldc"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se13/html/jvms-6.html#jvms-6.5.ldc
id: "6.5.ldc"
url: https://jvm.obfuscated.software/jvms/se13/6.5.ldc.html
raw: https://jvm.obfuscated.software/jvms/se13/6.5.ldc.md
---

# ldc

## Operation

Push item from run-time constant pool

## Format

```
ldc
index
```

## Forms

*ldc* = 18 (0x12)

## Operand Stack

... →

..., *value*

## Description

The *index* is an unsigned byte that must be a valid index into the run-time constant pool of the current class ([§2.5.5](2.5.5.md)). The run-time constant pool entry at *index* must be loadable ([§5.1](5.1.md)), and not any of the following:

- A numeric constant of type `long` or `double`.
- A symbolic reference to a dynamically-computed constant whose field descriptor is `J` (denoting `long`) or `D` (denoting `double`).

If the run-time constant pool entry is a numeric constant of type `int` or `float`, then the *value* of that numeric constant is pushed onto the operand stack as an `int` or `float`, respectively.

Otherwise, if the run-time constant pool entry is a string constant, that is, a `reference` to an instance of class `String`, then *value*, a `reference` to that instance, is pushed onto the operand stack.

Otherwise, if the run-time constant pool entry is a symbolic reference to a class or interface, then the named class or interface is resolved ([§5.4.3.1](5.4.3.1.md)) and *value*, a `reference` to the `Class` object representing that class or interface, is pushed onto the operand stack.

Otherwise, the run-time constant pool entry is a symbolic reference to a method type, a method handle, or a dynamically-computed constant. The symbolic reference is resolved ([§5.4.3.5](5.4.3.5.md), [§5.4.3.6](5.4.3.6.md)) and *value*, the result of resolution, is pushed onto the operand stack.

## Linking Exceptions

During resolution of a symbolic reference, any of the exceptions pertaining to resolution of that kind of symbolic reference can be thrown.

## Notes

The *ldc* instruction can only be used to push a value of type `float` taken from the float value set ([§2.3.2](2.3.2.md)) because a constant of type `float` in the constant pool ([§4.4.4](4.4.4.md)) must be taken from the float value set.
