---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 8 Edition"
java_version: 8
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/se8/html/jvms-6.html#jvms-6.5.ldc
id: "6.5.ldc"
url: https://jvm.obfuscated.software/jvms/se8/6.5.ldc.html
raw: https://jvm.obfuscated.software/jvms/se8/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.6](2.6.md)). The run-time constant pool entry at *index* either must be a run-time constant of type `int` or `float`, or a `reference` to a string literal, or a symbolic reference to a class, method type, or method handle ([§5.1](5.1.md)).

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

Otherwise, if the run-time constant pool entry is a `reference` to an instance of class `String` representing a string literal ([§5.1](5.1.md)), then a `reference` to that instance, *value*, is pushed onto the operand stack.

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

Otherwise, the run-time constant pool entry must be a symbolic reference to a method type or a method handle ([§5.1](5.1.md)). The method type or method handle is resolved ([§5.4.3.5](5.4.3.5.md)) and a `reference` to the resulting instance of `java.lang.invoke.MethodType` or `java.lang.invoke.MethodHandle`, *value*, is pushed onto the operand stack.

## Linking Exceptions

During resolution of a symbolic reference to a class, any of the exceptions pertaining to class resolution ([§5.4.3.1](5.4.3.1.md)) can be thrown.

During resolution of a symbolic reference to a method type or method handle, any of the exception pertaining to method type or method handle resolution ([§5.4.3.5](5.4.3.5.md)) 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.
