Java Foundation---Java conditional statement if...else (18)

Source: Internet
Author: User

The if...else of the Java conditional statement

The operation of the If...else statement is one step more than an if statement: when the condition is true, the code block of the if part is executed, and if the condition is not true, the else part is entered. For example, if the test result is more than 90 points, reward an IPHONE 5S, or do 500 push-ups.

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

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

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

Code:

Package Fangwei;


public class Helloworld {
public static void Main (string[] args) {
int age=2;

if (age>=18) {
SYSTEM.OUT.PRINTLN ("adult");
}else{
System.out.println ("minors");
}
}
}


The operation result is: underage

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

Java Foundation---Java conditional statement if...else (18)

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.