Java_se basic--14. Loop Structure Statement

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.