Source: http://www.imooc.com/code/1356
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.
Grammar:
Execution process:
For example:
Operation Result:
Task
Complete the code in the Code Editor to achieve the schedule: a final with a preliminary score of more than 80 points, followed by the gender division of the men's group finals and the Women's group finals.
The result of the operation is:
1 Public classHelloWorld {2 Public Static voidMain (string[] args) {3 intScore = 94;4String sex = "female";5 6 if(Score > 80) {7 if(Sex = "female") {8System.out.println ("Enter the women's team finals");9}Else if(Sex = "male") {TenSystem.out.println ("Enter the men's role"); One } A}Else { -System.out.println ("Not in the finals"); - } the } -}
Web-android Engineer first form nested if of -4-4 Java conditional statement