java新特性之可变参数
public class NewDemo01 {
public static void main(String[] args) {
System.out.print("No args(fun()):");
fun();
System.out.print("\n one args(fun()):");
fun(1);
System.out.print("\n five args(fun()):");
fun(1, 2, 3, 4, 5);
}
private static void fun(int... arg) {
for (int i = 0; i < arg.length; i++) {
System.out.print(arg[i] + "\t");
}
}
}