目录
一、加载和存储指令的概述
- 一、加载和存储指令的概述
- 二、加载和存储指令的内容
- 三、加载和存储指令的示例
- 加载和存储指令用于将数据在栈帧中的局部变量表和操作数栈之间来回传输。
-
将一个局部变量加载到操作数栈 iload、iload< n>、lload、lload< n>、fload、fload< n>、dload、dload< n>、aload、aload< n>;
-
将一个数值从操作数栈存储到局部变量表 istore、istore_< n>、lstore、lstore_ < n> 、fstore、fstore_< n>、dstore、dstore_< n>、astore、astore_< n>;
-
将一个常量加载到操作数栈 bipush、sipush、ldc、ldc_w、ldc2_w、aconst_null、iconst_ml、iconst_< i>、lconst_< l>、fconst< f>、dconst_< d>;
-
扩充局部变量表的访问索引的指令 wide
-
代码
public class Test1{ public int add(int a,int b){ int c= a + b; return 1+1; } }
-
执行javac命令,生成.class文件
-
执行javap命令,分析.class字节码文件