+ + and in Java–
•
Java
Difference between I + +, I -- and + + I, -- I:
I + +, I -- assignment before operation;
@H_ 502_ 17@++i , -- I is calculated before assignment;
@H_ 502_ 17 @ I + + assigns the value of I to j first, and then I adds 1, so I = 2 and j = 1 finally++ I is first I plus 1, and then I is assigned to j, so I = 3, j = 3;
@H_ 502_ 17 @ I -- first assign the value of I to j, and then I minus 1, so I = 2 and j = 3-- I is first I minus 1, and then I is assigned to j, so finally I = 1, j = 1;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码