fconst_0 0x0b

Pushes the float constant 0.

Opcode
0x0b (11)
Family
Constants
Operands
none
Length
1 byte
Operand stack
… → …, 0 (float)
Can throw
nothing at run time (beyond linking errors)
Spec name
fconst_<f>

What it does

Pushes the float 0.0f. Only 0, 1 and 2 have one-byte instructions; any other float constant needs ldc of a Float constant.

How often javac uses it

In JDK 25.0.5's java.base module, fconst_0 appears 40 times in 21 of its 7,391 classes: <0.01% of all instructions, the 172nd most common of 194 opcodes in use. Some of the methods that use it: java.io.ObjectStreamReflection.defaultReadObject, java.lang.Float.toHexString, java.lang.Math.max, java.math.BigDecimal.fullFloatValue.

Example

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

static float floats(float a, float b) in Tour, compiled by javac 25
… 11 instructions before
26x = x / b % 7f;
11ldc #13// 7
13frem
14fstore_2 // x
27return -x + 0f + 1f + 2f;
15fload_2 // x
16fneg
18fadd
20fadd
22fadd

Open in the viewer

Related instructions

ldc Pushes a constant from the constant pool (index in one byte).fload Pushes the float in local variable (operand).

Specification: JVMS §6.5, fconst_<f> (Java SE 25).