Java Basics---Nested if of a Java conditional statement (20)

Source: Internet
Author: User

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)

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.