Let's once again have a look at the code of the string sort. The for loop inside the while loop will go through all the elements from the first element (indexed with zero in Java) up to the last (indexed with n-1). Generally, this for loop has the same syntax as in C:
for( initial expression ; condition ; increment expression ) block
First, the initial expression is evaluated. It may contain a variable declaration, as in our example. The j variable in the preceding example is visible only inside the block of the loop. After this, the condition is evaluated, and after each execution of the block, the increment expression is executed. The loop repeats so long as the condition is true. If the condition is false right after the execution ...