Home > Back-end >  java
java

Time:10-07

Java study
i++;
And the I +=1
What is the difference between

CodePudding user response:

I++ again is to do operation + 1;
+ + I + 1 first, then do operation;
I +=1 is I=I + 1, but I +=1 running speed, the meaning is directly + 1,

CodePudding user response:

They are actually a mean
i++;=I=I + 1

I +=1;=I=I + 1

CodePudding user response:

+ + is only since the plus one, that is, I=I + 1
+=since more than one, can also be the add 2, since the + 3, such as
I +=4 is I=I + 4,
Besides the +=*=-=,=
/=%For example I *=21, said I=I * 21

CodePudding user response:

Said they did not mean a strict, occasions, some cases may be the same, but does not mean they are the same,