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