Home  >  Article  >  Java  >  What are the differences between the three loop structures in java

What are the differences between the three loop structures in java

王林
王林forward
2020-11-11 15:11:112492browse

What are the differences between the three loop structures in java

The difference between three types of loops

(Learning video sharing: java course)

Judge first between for loop and while loop Whether the condition is true, then decide whether to execute the loop body (judge first and then execute)

do...while loop first executes the loop body once, and then determine whether the condition is true, and whether to continue executing the loop body (execute first and then judge)

The difference between for loop and while

The auto-increment variable controlled by the conditional control statement, because of the syntax structure of the for loop, cannot be accessed again after the for loop ends

The self-increasing variable controlled by the conditional control statement does not belong to the syntax structure of the while loop. After the while loop ends, the variable can continue to be used

Infinite loop (infinite loop) Three formats

for(){}
while(true){}
do {} while(true);

Related recommendations:Getting started with java

The above is the detailed content of What are the differences between the three loop structures in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete