goto in Java bytecode

后端 未结 9 660
一向
一向 2020-12-16 11:58

So the other day when I was looking at the wikipedia page for Java bytecode I came across this example:

Consider the following Java code:

9条回答
  •  时光取名叫无心
    2020-12-16 12:33

    1. SpaceTrucker mentioned (in comments to head question) a difference between the Java language itself and bytecode. The goto keyword and goto instruction are not the same. The only common thing is the name. In case of bytecode it is just an instruction of JUMP (JMP);
    2. Basically, goto is thought to be a bad practice in programming/coding, because of realizing the 'spagetti' code and making worse the readability of code.

提交回复
热议问题