The syntax of a for loop in Java is always the same. The loop is introduced by the “for” keyword. This is followed by the initialization of the variable to be executed, then the termination condition, and finally the change to the variable to be executed. The three components are separated from each other by a semicolon. After the last expression, however, one should refrain from putting a semicolon.
Next are the execution statements in the connection inside the loop body, which is again separated by braces. The basic structure looks like this: