IF 语句是选择结构中最基本的语句,IF 语句的两种形式:IF 以及IF ELSE。
比较两个数的大小:
public class BiJiao{
public static void main(String args[]){
int x =3; int y = 1; // 定义两个整型变量X,Y。给予初试值。//
if (x - y > 0)
System.out.println("x > y");
else{
if (x - y < 0)
System.out.println("x < y");
else
System.out.println("x = y");
}
}
}