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 25Related 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).