Thursday, October 23, 2008

Methods with var-args (Objective 1.4)

As of Java 5, methods can declare a parameter that accepts from zero to many arguments, a so-called var-arg method.
A var-arg parameter is declared with the syntax type... name; for instance: doStuff(int... x) { }
A var-arg method can have only one var-arg parameter.
In methods with normal parameters and a var-arg, the var-arg must come last.

No comments: