package test;
public class myTest {
    // 根据输入的参数动态生成数组
    public static int max(int... param) {
        int max = 0;
        int length = param.length;
        for (int i = 0; i < length; i++) {
            if (max < param[i]) {
                max = param[i];
            }
        }
        return max;
    }
    public static void main(String[] args) {
        int test1 = max(1, 2, 3, 5);
        int test2 = max(0, 6, 3, 6, 9, 7);
        System.out.println("test1=" + test1 + "  test2=" + test2);
    }
}
————————————————
版权声明:本文为CSDN博主「chance_66」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/never_tears/article/details/78027823
来源:CSDN
作者:留下的弥足珍贵
链接:https://blog.csdn.net/qq_15110681/article/details/103699367