Java Series Learning (v)-Process Control statements

Source: Internet
Author: User

1. Sequential structure

1.if statements

(1) Legend

(2) Three formats

A: Format 1

B: Format 2

C: Format 3

2.swich statements

Legend:

Format:

"Note" Input can be an enumeration after Byte,short,int,char;jdk5; JDK7 can be a string later;

3. Looping statements

Legend:

(1) For loop

(2) While loop

Legend:

Usage:

(3) Do...while cycle

Legend:

Usage:

(4) difference between for and while

A: the difference in use

The control condition variable for the For statement can no longer be used after the loop has ended, while the while continues to use the

B: The difference in understanding

"For a range of judgments, while suitable for loops with ambiguous times"

(5) The difference of three kinds of cycles

A:do...while Loop performs at least one loop body

The b:for and while must first determine if the condition is true before deciding whether to execute the loop

4. Controlling Jump Statements

(1) Break: Meaning of the Interruption

A: Used in loops and switch statements, leaving the sub-scenario meaningless

B: function:

"A. Jumping out of a single-layer loop"

"B. Jumping out of a multilayer loop, requiring a mate of a label statement"

(2) Continue: Continue

Function: Jump out of a loop and go to the next execution

(3) Return: Back

A: Used to end the execution of the method

B: Must have encountered return, the program will not be executed back

Java Series Learning (v)-Process Control statements

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.