lconst_0 0x09

Pushes the long constant 0.

Opcode
0x09 (9)
Family
Constants
Operands
none
Length
1 byte
Operand stack
… → …, 0 (long)
Can throw
nothing at run time (beyond linking errors)
Spec name
lconst_<l>

What it does

Pushes the long 0L. Only 0 and 1 have one-byte instructions; any other long constant needs ldc2_w of a Long constant.

How often javac uses it

In JDK 25.0.5's java.base module, lconst_0 appears 2,402 times in 515 of its 7,391 classes: 0.12% of all instructions, the 81st most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.skip, java.io.BufferedReader.skip, java.io.ByteArrayInputStream.skip, java.io.CharArrayReader.skip.

Example

From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; lconst_0 is highlighted.

static long constants() in Tour, compiled by javac 25
… 5 instructions before
129int a = -1, b = 5, c = 100, d = 1000, e = 100000;
6istore_2 // c
7sipush 1000
10istore_3 // d
11ldc #66// 100000
13istore 4// e
130long f = 0, g = 1, h = 123456789012L;
16lstore 5// f
19lstore 7// g
21ldc2_w #67// 123456789012L
24lstore 9// h
131double i = 0.5;
26ldc2_w #69// 0.5
… 30 instructions after

Open in the viewer

Related instructions

ldc2_w Pushes a long or double constant from the constant pool.

Specification: JVMS §6.5, lconst_<l> (Java SE 25).