I. Using the FOR statement to complete the summation
The For statement is similar to the while statement and can be used as an additive algorithm
For and while statements, there is a small difference between the two, the local variable control range is different.
If the initial variable is used to control the loop, then using for is more efficient than the while and can free the unused local variables.
Two. Infinite loops
In the late development, the infinite loop is applied. The programmer can sometimes not determine the number of cycles, and in the loop, it may produce unlimited operations.
For the intermediate expression is not written, the default is true.
It's strange that we've had a discussion before about simply writing a Boolean data, which seems to work .
Note: Today, when you write again, DOS can be compiled and executed, the previous program is not written wrong?
Strange, How is System.out.println ("over!"); What about mistakes?
We put down the error of the output statement, first look at while the condition of the statement can be recognized directly input true data, the display is can, but no control of the number of cycles, operations can be manipulated. To look back at the error of the output statement is that you cannot execute to the output statement, which is always in the loop.
Java-preliminary Understanding-Chapter III-Practice of statement-for