Getting Started with Java (4)--Process Control

Source: Internet
Author: User
Choose

If the program only executes sequentially, the program's behavior may be much simpler, but it will also lose most of its powerful features and highlights.

It is the " branch " that breaks the rigid situation of sequential execution and injects real vitality into the program.

The branches in Java are mainly provided by the selection and looping statements, and their syntax is basically the same as the C language.

If...else ... I'm afraid it's the most familiar to us. It has many forms of expression.

if (conditional) statement;

Or

if (condition) {

Statement 1;

Statement 2;
...

}

Some coding specifications require that even if there is only one statement, it should be enclosed in curly braces.

Or

if (condition) {

Statement

}

else {

Statement

}

Or

if (condition) {

Statement

}

else if (condition 2) {

Statement

}

else if (condition 3) {

Statement

}

else{

Statement

}

A,b,c the largest number of three numbers in a variety of styles.

Getting Started with Java (4)--Process Control

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.