String... to 可变参数的使用

 public class testMail {

     public static void fun(int... x) {
for(int i = 0;i < x.length;i++) {
System.out.print(x[i] + ",");
}
}
public static void main(String args[]) throws Exception{
fun(5); System.out.println("");
fun(5,6); System.out.println("");
fun(5,6,7);
}
}

输出:
5,

5,6,

5,6,7,

上一篇:Jquery表单验证


下一篇:c++ --> 重载、重写(覆盖)和隐藏的区别