package cn.edu.bjut.chapter2; import java.util.Random; public class IfElse { public static void main(String[] args) { Random random = new Random(); // 声明随机数类对象并实例化 int m = random.nextInt(); // 产生随机整数 System.out.println("m = " + m); int n = random.nextInt(); // 产生下一个随机整数 System.out.println("n = " + n); if (m < n) { System.out.println("The minimum of m and n is " + m); } else if (n < m) { System.out.println("The minimum of m and n is " + n); } else { System.out.println("m is equal to n"); } } }