运算符例题

所谓++i:就是先加上变量,运算在加一次

public static void main(String[] args) {
int i = 1;
int j = i;
if ((i > ++j))// i=1不成立j=2走else
{
System.out.println(i++);
} else {
System.out.println(++j);// 前缀先自增:2,在运算:3
}
}

-----------------------------------------------------------------------------------------------------------

h +=1;等价于h=h+1;

h +=1会自动强转,会自定义转换

h=h+1不会转,只是自动提升

 

 

 

原文地址:https://www.cnblogs.com/Koma-vv/p/9266098.html