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)