Suggested that some basic students read, 0 basis may be somewhat difficult (it is best to look at the text with the basic textbook example)
The so-called circular statement is mainly to meet the conditions of the case of repeated execution of an operation. Java provides 3 commonly used loop statements, respectively, for loop statements, while loop statements, and Do-while loop statements, which are described in the following 3 kinds of circular statements.
First: While statement "he will tell the compiler to execute a set of code repeatedly until a certain condition is met"
His grammatical form is: while(boolean condition){
// statements to be looped
}
Second:do-while statement "At least one loop must be executed"
appropriate syntax:do{// execution Loop statement
}while(boolean conditional type);
Small Summary: " while statement is to execute a Boolean condition, and then execute the Loop statement and the do-while Statement First ensure that the loop body at least one cycle"
Third: the for statement "is the most common, most used, and most typical loop statement"
corresponding syntax:for(initialization statement; Boolean conditional; Iteration statement){
// output PRINT statement
}
Java 3 break statement, continue statement and return statement. The jump statement is used to implement a jump in the program flow during the loop execution, as follows for this 3 . Span style= "text-align:justify; Text-indent:28px "> A jump statement is described in detail.
Break "jump out of theloop when a certain condition is met"
All of the above loops can jump out of the loop with break .
V:Continue"If a loop is executed, one or several of them want to skip the loop. With continue can do "
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Java_se basic--14. Loop Structure Statement