Reading today finds a very interesting question.
What will the following program output?
public class Test2 {
public static void Main (string[] args) {
int j = 0;
for (int i = 0; I < 100; i++) {
J = j + +;
}
System.out.println (j);
}
}
The result of the output is: 0 just saw the time to feel very strange, I chose the answer is 100, and then read the book to explain what is the middle cache variable, the result of the mess, the final discovery actually explained is very simple, completely do not write on the book that a bunch of messy things, when the implementation of j= J + +, is the value of J that is equal to 0 to the J, and then the back of the J, but the next time the execution of J is equal to 0; in other places are interpreted as the Java intermediate cache variable, anyway, I do not understand and what is the relationship between the other language is not so?
"Java Programmer interview Book" Reading notes 1