Java Programming Thought study notes-fourth chapter control the execution process

Source: Internet
Author: User

True and False

All conditional statements use the true or false of the conditional expression to determine the execution path.

If-else

if (boolean-expression)

Statement

Or

if (boolean-expression)

Statement

Else

Statement

Iteration

While, Do-while and for to control loops, sometimes they are divided into iteration statements (iteration statement). The statement is repeated until the Boolean expression (booleanexpression) that controls the action gets the result of "false".


While loop

while (boolean-expression)

Statement


Do-while Cycle

Do

Statement

while (boolean-expression)


For loop

for (initialization; Boolean-expression; Step

Statement


Enhanced for

Used for arrays and containers, such as:

For (String s:new string[] {"1", "2"})

Statement


Loop control:

return break continue


Switch

Switch (selector) {

Case Value1:statement; Break

Case Value2:statement; Break

Case Value2:statement; Break

// ...

Default:statement;

}

Where the selection factor selector, can be shaping, enum, String (added after jdk1.7)

This article is from the "Small City Ops" blog, please be sure to keep this source http://lixcto.blog.51cto.com/4834175/1887446

Java Programming Thought study notes-fourth chapter control the execution process

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.