This is the 'var args' specifier .
This means that you can pass 0 or more elements to a method.
You would use it as follows:
public void method(String str, int... elements) { for (int i = 0; i < elements.length; i++) { print(str + " " + elements[i]; } }
and you can call it like this:
method("Hi"); method("He", 1, 2 , 3, 4, 5); method("Ha", 1 , 2); int[] arr = {1, 2 , 3 ,3 ,4}; method("Ho", arr);
source share