Home > Back-end >  How to understand the Java?
How to understand the Java?

Time:10-19

Int x=1;
X=x++;

System. The out. Println (x);

Output 1

CodePudding user response:

I++, after use the add first; + + I, since the first add after use; , you can do several ways to understand more about how to run a few times to understand, no tangle, you can read more in the case, should have to explain that, after all, textbooks are fond of speaking like a book, it is very suitable for speaking like a book,

CodePudding user response:

First calculate=on the right side of the value of the expression, x++ first take the value of x 0 as the value of the expression, since then x increase to 1, and then assign the value of the expression 0 to x, so eventually x is 0

CodePudding user response:

Hadn't been aware of the initial value is 1 x
X++ first take the value of x 1 as the value of the expression, then the increase to 2 x, and then assign the value of the expression 1 to the left of the=x, so eventually x is 1
  • Related