The If of the Java Learning Process Control

Source: Internet
Author: User
Tags case statement

Learn to program Java learning Process Control if released, you are welcome to visit through the xuebiancheng8.com

The process Control statements in Java mainly include the choice statement, the Loop statement, where the SELECT statement also includes the IF statement, the Switch...case statement, the loop statement including the While,do...while and for loops and other institutions. below to analyze and analyze the usage of If...else

If select structure is divided into if single branch structure, If...else ... Dual-branch structure, If...else if....else if ... else, etc. multi-branch structure

A single branch structure, as the name implies only one if structure.

int a = 10;

if (a>5) {

System.out.println (' a>5 ');

}

This example is a single-branch structure, as the name implies there is only one if selection

Look at the two-branched structure below,

int a = 10;

if (a>5) {

System.out.println (' a>5 ');

}else{

System.out.println (' a<=5 ');

}

The above is a two-branch structure, as the name implies, two choice is two branches

There is also a choice structure that is If...else if...else IF....ELSE this structure

int score = 80;

if (score>=90) {

System.out.println ("A");

}else if (score>=80) {

System.out.println (' B ');

}else if (score>=70) {

System.out.println (' C ');

}else if (score>=60) {

System.out.println ("D");

}else{

System.out.println ("E");

}

The above is a two-branch structure, as the name implies can be selected from multiple choices

For details, please watch it through xuebiancheng8.com, the URL is http://xuebiancheng8.com/play/goodgoodstudy_53_daydayup.html


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.