【JAVA习题十二】输入三个整数x,y,z,请把这三个数由小到大输出。

package erase;
import java.util.Scanner;
public class 大小比较 {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner in=new Scanner(System.in);
        int x=in.nextInt();
        int y=in.nextInt();
        int z=in.nextInt();
        max(x,y,z);
    }
    public static void max(int x, int y ,int z) {
        int max=0;
        if(x>y) {
            max=x;
        }
        else max=y;
        if(max>z) {
            System.out.print(max);
        }
        else System.out.print(z);
    }

}
原文地址:https://www.cnblogs.com/chenxi1944362410/p/13031477.html