public static void printMax(int... numbers){ //如果还有其它普通参数,int.. number)要放在最后 if(numbers.length==0){ System.out.println("没有参数"); return; } int max=numbers[0]; for (int i = 1; i < numbers.length; i++) { max=Math.max(max,numbers[i]); } System.out.println("The max value is:"+max); }