Java Basis---Java conditional statement if (17)

Source: Internet
Author: User

If of a Java conditional statement

In life, we often need to make judgments before deciding whether to do something. For example, if your test score is greater than 90, reward an IPHONE 5S. You can use the if condition statement to implement situations where you need to determine the condition before the condition is met.

Syntax: 650) this.width=650; "src=" http://img.mukewang.com/5364ef240001832c01830068.jpg "/>

Execution process: 650) this.width=650; "src=" http://img.mukewang.com/53635a6b00011ebc01660184.jpg "/>

such as: 650) this.width=650; "src=" http://img.mukewang.com/5364edff0001e2f004580095.jpg "/>

Note: If the IF condition is set when the execution statement is only one, it is possible to omit the curly brace drop! But if there are multiple execution statements, then curly braces are indispensable.


Code:

public class HelloWorld {
public static void Main (string[] args) {
int one = 20;
if (one%2==0) {

System.out.println ("One is even");
}




}
}


Operation Result:

One is an even number


This article is from "Ghost" blog, please make sure to keep this source http://caizi.blog.51cto.com/5234706/1547684

Java Basis---Java conditional statement if (17)

Related Article

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.