class Test1_Operator {
public static void main(String[] args) {
//第一题-请分别计算出a,b,c的值?
/*
int a = 10;
int b = 10;
int c = 10;
a = b++; //a = 10 b = 11
c = --a; //c = 9 a = 9
b = ++a; //b = 10 a = 10
a = c--; //c = 8 a = 9
System.out.println("a = " + a + ",b = " + b + ",c = " + c); // a =9 ,b = 10 ,c = 8
*/
//第二题-请分别计算出x,y的值?
//int x = 4;
// y4x5, x6y10,x=6 y= 4 + 6 + 6 * 10
//int y = (x++)+(++x)+(x*10);
//System.out.println("x =" + x + " y = " + y ); //x = 6 y = 70
//第三题-面试题
//byte b = 10;
//b++; //b= (byte)(b + 1)
//b = b + 1;
//问哪句会报错,为什么
//第三行会报错,在byte类型与int类型混合运算时会提升为int类型,两个int类型相加结果还是int类型,赋值给byte会损失精度.
}
}