javap分析一行简单的运算符代码,不多解释。
code:
/**
* Created by zkai on 2015/1/21.
*/
public class Test {
public static void main(String[] args) {
int x = 10;
x += x += x -= x - 2;
System.out.println(x);
// 等价于...
int y = 10;
int tmp1 = y - 2;
int tmp2 = y - tmp1;
int tmp3 = y + tmp2;
int tmp4 = y + tmp3;
y = tmp4;
System.out.println(y);
System.out.println(y == x);
}
}
javap 分析: