package work;
import java.util.Scanner;//导包,获取键盘输入
public class Demo01 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输入数字a");
int a = sc.nextInt();
System.out.println("输入数字b");
int b = sc.nextInt();
System.out.println("输入数字c");
int c = sc.nextInt();
if (c < a && c < b && b < a) {// 通过比较c System.out.println("一号a:" + a+"\n二号b:" + b+"\n三号c:" + c); } else if (c < a && b < c && b < a) { System.out.println("一号a:" + a+"\n二号c:" + c+"\n三号b:" + b); } else if (c < a && c < b && a < b) { System.out.println("一号b:" + b+"\n二号a:" + a+"\n三号c:" + c); } else if (a < c && a < b && c < b) { System.out.println("一号b:" + b+"\n二号c:" + c+"\n三号a:" + a); } else if (a < b && a < c && b < c) { System.out.println("一号c:" + c+"\n二号b:" + b+"\n三号a:" + a); } else if (b < a && b < c && a < c) { System.out.println("一号c:" + c+"\n二号a:" + a+"\n三号b:" + b); } } } 解题思路: 可以用if else if语句判断,通过else if多次判断来输出。