Whether I say „j++“ or „++j“ in the for-loop j is always increased after the loop is finished. WHY? Why is it the same to say „i++“ or „++i“ in the loop? The result is always that „i“ is increased ? WHY?
Because that is what both the pre-increment and post-increment operator do - incrementing the variable. The only difference between them is the *value of the expression*. The following code should make that clear:
Did that help?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Whether I say �j++� or �++j� in the for-loop j is always increased after the loop is finished. WHY? Because that's how for-loops in Java work. First the declaration/initialization part is performed. Then the test is performed. If the test returns true, then the loop body is executed with the current value(s) of any identifiers declared/used in the initialization and increment sections of the for-loop declaration. Then any statements in the increment section of the loop declaration are performed. These statements typically increment some variable or otherwise cause the loop to get closer to termination. These statements are each executed in isolation any other statement. Then the test is performed again and the process repeats as necessary.