Different behaviour of java bytecode

前端 未结 6 1272
面向向阳花
面向向阳花 2020-12-30 03:17

I am a newbee in Java Bytecode. I was understanding the bytecode through some examples but I got stuck in an example.
These are my java and bytecode file



        
6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 03:47

    iconst can push constant values -1 to 5. It is a single-byte instruction.

    bipush can push constant values between -128 and 127. It is a two-byte instruction.

    To push 9 you cannot use iconst. There is no iconst_9 instruction.

提交回复
热议问题