Constant values are either values of named constants, values of unnamed constants, like the values 1 and 2 in the expression showed earlier, or values of precalculated results of parts of the expression. The generated code has to load the value on the operand stack.
If the value is of one of the types integer, real or string, the value is stored in the constant_pool[] and is loaded on the operand stack by the following code:
If the index of the value in the constant_pool[] is a wide index, the ldc_w instruction is used instead.
If the value is of type char or boolean, the value is not stored in the constant_pool[] because it fits in one byte. Therefore the code to load the value on the operand stack is: