goto in Java bytecode

后端 未结 9 661
一向
一向 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:19

    goto is fine at machine level, java compiler are not writing code, it only converts code from java source to bytecode.

    For people writing code this is diffrent story, goto instruction are hard to read and analyze and code is the mess after many goto jumps. This is why people should use OO concepts instead of jump instructions.

提交回复
热议问题