What do three dots (...) indicate when used as a part of parameters during method definition?
Also, is there any programming term for the symbol of those 3 dots?
I noticed in a code sample:
public void method1 (Animal... animal) {
// Code
}
And this method was called from 2 places. The arguments passed while calling were different in both scenarios though:
Array of objects is passed as an argument to method1(Animal...)
Object of class Animal passed as an argument to method1(Animal...)
So, is it something like, if you are not sure whether you will be passing a single element of an array or the entire array as an argument to the method, you use 3 dots as a part of parameters in the method definition?
Also, please let me know if there is any programming term for the symbol of those 3 dots.