package big.com.Cai; public class Annotation { public static void main(String[] args) { System.out.println(printMax(new double[]{1,2,3})); System.out.println(printMax(77.5, 32.4, 34.6, 99.0)); } public static double printMax(double... num){ double result=num[0]; for (int i = 1; i < num.length; i++) { if(result<num[i]) result=num[i]; } return result; } }
输出: