package com.interview.javabasic.bytecode;
public class ByteCodeSample {
private static volatile Integer i = 1;
public static void main(String[] args) {
int j=5;
i++;
++j;
System.out.println(i);
System.out.println(j);
}
}
如上所示代码编译之后字节码文件如下:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.interview.javabasic.bytecode;
public class ByteCodeSample {
private static volatile Integer i = 1;
public ByteCodeSample() {
}
public static void main(String[] var0) {
byte var1 = 5;
Integer var2 = i;
i = i + 1;
int var4 = var1 + 1;
System.out.println(i);
System.out.println(var4);
}
}