---restore content starts---
There are several looping structures in Java, which I summarize myself as: IF-ELSE selection structure, multiple if selection structure, nested if selection structure, switch selection structure, while loop, Do-while Loop, for loop and nested loop.
IF-ELSE Selection Structure: if (conditional expression) {statement block};else {statement block};
Multiple if selection structure: if (conditional expression) {statement block}; else if (conditional expression) {statement block}; else if (conditional expression) {statement block}; ........
Nested IF selection structure: In the while loop, the if selection structure is nested within the For loop.
Switch selection structure: switch (expression) {Case constant 1: statement; Break;case constant 2: statement; Break;........default: statement;} switch is mostly equivalent, because the case is followed by a constant.
While loop: while (loop condition) {looping operation}, while feature is: first judge the condition, the condition conforms to the loop operation, until the loop condition is not satisfied, is not in the execution loop!
Do-while loop: Do {cyclic operation}while (cyclic condition); it is characterized by: first do a cycle, in judging the cycle conditions, conditions, continue to execute the loop body, does not meet the conditions, exit cycle!
For loop: for (parameter initialization; loop condition; iteration) {Looping operation}
Nested loops: In the loop body, nested loops.
The For loop differs from the while loop in that the number of loops in the for loop is fixed, the for loop can be replaced with a while loop, and the while loop may not be replaced with a for loop.
In summary: The loop generally consists of four parts, which are cyclic variables, cyclic conditions, cyclic operations, loop iterations.
---restore content ends---
The loop structure in Java