java - What is x after "x = x++"? -
what happens (behind curtains) when executed?
int x = 7; x = x++;
that is, when variable post incremented , assigned in 1 statement? compiled , executed this. x
still 7 even after entire statement. in book, says x
incremented!
x
incremented. assigning old value of x
itself.
x = x++;
x++
increments x
, returns old value. x =
assigns old value itself.
so in end, x
gets assigned initial value.
Comments
Post a Comment