OnJava8-Examples/initialization/AutoboxingVarargs.java

19 lines
356 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: initialization/AutoboxingVarargs.java
public class AutoboxingVarargs {
public static void f(Integer... args) {
for(Integer i : args)
System.out.print(i + " ");
System.out.println();
}
public static void main(String[] args) {
2015-05-05 14:05:39 -07:00
f(1, 2);
2015-04-20 15:36:01 -07:00
f(4, 5, 6, 7, 8, 9);
2015-05-05 14:05:39 -07:00
f(10, 11, 12);
2015-04-20 15:36:01 -07:00
}
} /* Output:
1 2
4 5 6 7 8 9
10 11 12
*///:~