标题: 第二天,自增运算面试题分析 [打印本页] 作者: happyburglar 时间: 2016-6-28 22:51 标题: 第二天,自增运算面试题分析 class Demo1{
public static void main(String[] args){
/*int a = 10;
int b = 10;
int c = 10;
a = b++; //b先赋值给a,然后自增:a = 10,b = 11
c = --a; //a先自减,然后赋值给c:a = 9 ,c = 9
b = ++a; //a先自增,然后赋值给b:a = 10,b = 10
a = c--; //c先赋值给a,然后自减:a = 9 ,c = 8
System.out.println("a =" + a);
System.out.println("b =" + b);
System.out.println("c =" + c);
*/
int x = 4;
// 4 6 60
int y = (x++)+(++x)+(x*10);
System.out.println("(x++)+(++x)+(x*10)=" + y);