我有以下Java类:
public class ArtClassInt {
public boolean foo(int x) {
if(x == 3956681)
return true;
else
return false;
}
public boolean boo(int x) {
if(x <= 952140568)
return true;
else
return false;
}
public boolean boo1(int x, int y) {
if(x <= y)
return true;
else
return false;
}
public boolean zoo(int x) {
if(x+1 < 1267)
return true;
else
return false;
}
}
当我编译它并得到它的字节码时,我得到了以下与源代码中的 if 语句相对应的语句:
ArtClassInt.boo1(II)Z: I4 Branch 3 IF_ICMPGT L17 - true
ArtClassInt.boo1(II)Z: I4 Branch 3 IF_ICMPGT L17 - false
ArtClassInt.boo(I)Z: I4 Branch 2 IF_ICMPGT L10 - true
ArtClassInt.boo(I)Z: I4 Branch 2 IF_ICMPGT L10 - false
ArtClassInt.foo(I)Z: I4 Branch 1 IF_ICMPNE L3 - true
ArtClassInt.foo(I)Z: I4 Branch 1 IF_ICMPNE L3 - false
ArtClassInt.zoo(I)Z: I6 Branch 4 IF_ICMPGE L24 - true
ArtClassInt.zoo(I)Z: I6 Branch 4 IF_ICMPGE L24 - false
我对助记符(即,,等)完全感到IF_ICMPGE困惑IF_ICMPNE。通过查看源代码,我希望:
方法中的 if 语句不 foo应该是if_icmpeqIF_ICMPNE
boo和方法中的 if 语句不boo1应该是。 if_icmpleIF_ICMPGT
方法中的一个zoo应该 if_icmplt不是IF_ICMPGE。
有人可以解释这背后的原因吗?
互换的青春
红糖糍粑
汪汪一只猫
随时随地看视频慕课网APP
相关分类