1 public class testMail { 2 3 public static void fun(int... x) { 4 for(int i = 0;i < x.length;i++) { 5 System.out.print(x[i] + ","); 6 } 7 } 8 public static void main(String args[]) throws Exception{ 9 fun(5); System.out.println(""); 10 fun(5,6); System.out.println(""); 11 fun(5,6,7); 12 } 13 }
输出:
5,
5,6,
5,6,7,