Push single float 0.0, 1.0 or 2.0
Bytecode
Type | Description |
u1 | fconst_0 opcode = 0x0B (11) |
u1 | fconst_1 opcode = 0x0C (12) |
u1 | fconst_2 opcode = 0x0D (13) |
Push the float
constant <f> (0.0, 1.0, or 2.0)
onto the operand stack.
fconst_<f> represents the series of opcodes fconst_0, fconst_1, and fconst_2 that are used to push the constant single-precision floats 0.0, 1.0 and 2.0 onto the stack.
Note that you could also use ldc command, although this instruction takes more space in the class file and is also less efficient.
Example
fconst_0 ; push the float 0.0 onto the stack fconst_1 ; push the float 1.0 onto the stack fconst_2 ; push the float 2.0 onto the stack