disassemble the code

这是对字节码文件进行操作的,假设有Test.class

 

javap -c Test

 

int b = 9;
b = b + (b = 3);

 

  Code:
   0:   bipush  9
   2:   istore_1
   3:   iload_1
   4:   iconst_3
   5:   dup
   6:   istore_1
   7:   iadd
   8:   istore_1
   9:   return

 

1.可以看到,先将9存给b
2.取b值,即9
3.得到常量值3,与9次第入栈
4.将3存给b
5.执行栈中加法操作
6.保存至b并返回

你可能感兴趣的:(C++,c,C#)