流程
程序的流程就是代码的执行顺序。
判断结构
if语句
第一种格式
if(条件表达式)
{
执行语句
}
第二种格式
if(关系表达式){
语句体1
}else{
语句体2
}
案例:输入一个整数,判断它是奇数还是偶数
public class ifDemo1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入你的数值:");
int x = sc.nextInt();
if (x % 2 == 1) {
System.out.println("x为奇数");