Java increment trap

and a ++ a ++ a = two equations are different, the operation after adding a ++ represents a, a = a ++ represents a still as a

int a=0;
for (int i=0;i<10;i++){
   a=a++;      
}

Finally, a value of 0 or as a ++ is returned first and then add one, so a plus in a previously has been re-assigned to the 0

 

Guess you like

Origin www.cnblogs.com/saifei1125/p/11725429.html