Chaos_祥
int a = 1; int b; //b = a;赋值表达式,是有值的,这个值是赋值的结果,即1 int c = b = a = 8;//计算顺序:c=(b=(a=8)); //实际是将赋值表达式a=8的值赋值给b,注意是将赋值表达式的值赋值给b //同样的将之前的赋值表达式的值赋值给c System.out.println("c = " + c); c = (b = (a = 8) + 3); //计算顺序: //1)首先计算赋值表达式a=8,此时a==8,该表达式的值也等于8 //2)将a=8赋值表达式的值和3相加,和赋值给b //3)将最外面括号的赋值表达式的值赋值给c System.out.println("c = " + c); a = 1; b = a+=2; //计算顺序 //1)计算a+=2,此时a==3,该赋值表达式的值也是3 //2)将a+=2表达式的值赋值给b System.out.println("b = " + b);