根本数据类型对应字节码

基本数据类型对应字节码
【零】布尔型
boolean boo = true;
对应字节码
0:   iconst_1
1:   istore_1


【①】byte型:
byte m = 1;
对应的字节码:
0:   iconst_1
1:   istore_1

【②】int型:
int m = 1;
对应字节码
0:   iconst_1
1:   istore_1


【③】short型:
short m = 1;
对应字节码
0:   iconst_1
1:   istore_1


【④】long型:
long m = 1;
对应字节码:
0:   lconst_1
1:   lstore_1

【⑤】char型:
char m = 'a';
对应的字节码:
0:   bipush  97
2:   istore_1

【⑥】float型:
float m = 1.0f;
对应的字节码:
0:   fconst_1
1:   fstore_1

【⑦】double型:
double m = 1.0;
对应的字节码:
0:   dconst_1
1:   dstore_1

可以发现boolean,int,short,byte都是已iconst开头,这说明这几个类型在jvm看来都是同一个类型。没多大区别
解释一下命令的大致意思:
Tconst:将常量加载到操作数栈中。后面的数字相当于索引。T可替换为i,l,f等等
Tstore:将一个数值从操作数栈存储到局部变量表中
其中char的bipush 97就是把常量97加载到操作数栈中,供后面操作使用。