Learn to program Java Learning while the loop is published, welcome to visit through Xuebiancheng8.com
The previous analysis of Java's Process control is divided into select structure, loop structure, wherein the loop structure is divided into while,do...while and for loop
Below to analyze the while loop in the next loop structure
Why should there be a while loop in Java? Let's look at an example.
What do I do now to perform 10,000 i++ operations?
To do this, we have to do a 10,000-line i++ operation. This wastes a lot of time. This time you can use the Loop statement to implement, as long as a few simple lines of code.
while (i<=10000) {
System.out.println (i);
i++;
}
The above example is the while loop, which can help us print 10,000 times the value of I and perform 10,000 i++ operations.
below to analyze the syntax of the next while
while (condition) {
Cyclic operation;
}
The loop operation is performed when the condition is satisfied, that is, when the value of the condition is true.
While loop is characterized by first judgment and execution, when the condition is not established, the loop may not be executed once.
When the loop is not fixed, it is recommended to use a for loop when the number of loops is fixed.
Please visit xuebiancheng8.com for details. The specific URL is
Http://xuebiancheng8.com/play/goodgoodstudy_59_daydayup.html