Nested if of a Java conditional statement
Nested IF statements determine the condition of the inner if if the condition of the outer if is true. For example, the schedule of activities, if today is a working day, then go to work, if today is the weekend, then go out to play, at the same time, if the weather is clear on weekends, the outdoor playground to play, otherwise go to the indoor playground.
Syntax: 650) this.width=650; "src=" http://img.mukewang.com/5364f3be000121bf01480198.jpg "/>
Execution process: 650) this.width=650; "style=" width:260px; "src=" http://img.mukewang.com/5364bd8f0001c91e03690285.jpg "/ >
For example:
650) this.width=650; "style=" width:350px; src= "Http://img.mukewang.com/53703cb10001f78a06340312.jpg"/>
Operation Result: 650) this.width=650; "src=" http://img.mukewang.com/5364bdf20001a9cb01720029.jpg "/>
Code:
public class Helloworld {
public static void Main (string[] args) {
int score = 94;
String sex = "female";
if (score>80) {
if (Sex.equals ("female")) {
System.out.println ("Enter the women's group Finals");
}else{
System.out.println ("Enter the men's group final");
}//This is a group of if...else inside ...
}else{
System.out.println ("Home");
}
/*
* This is a simple if...else ... Nested structures
*/
}
}
Running Result: Enter the women's final
This article is from "Ghost" blog, please make sure to keep this source http://caizi.blog.51cto.com/5234706/1547711
Java Basics---Nested if of a Java conditional statement (20)