Feature Overview
This feature enables varargs parameters in methods.
This feature enables varargs parameters in methods.
None.
public class VarargsDemo {
private static void run(Integer num, String ...args) {
}
public static void main() {
run(10, 'a', 'b');
}
}
public class VarargsDemo {
private static void run(Integer num, List args) {
}
public static void main() {
run(10, new List{ 'a', 'b' });
}
}
The var-args parameter should be the last parameter in the method and the method should contain at most one var-args parameter. Besides, overloading methods with var-args may cause ambiguity.
Contribute on Github! Edit this section.