java if else 用法
//1.导入Scanner类
import java.util.Scanner;
class TestIf{
public static void main (String [] args){
//创建Scanner对象
Scanner scanner = new Scanner(System.in);
//3.获取输入的整数
System.out.print("i = ");
int i = scanner.nextInt();
System.out.println("输入的i为:" + i);
int age = 10;
if(age > 24){
System.out.println("大学毕业");
}
else if (age > 20){
System.out.println("高中毕业");
}
else if (age > 17){
System.out.println("初中毕业");
}
else if (age > 14){
System.out.println("小学毕业");
}
else if (age > 8){
System.out.println("小学");
}
else {
System.out.println("没上小学");
}
}
}