Rob Spoor wrote:Or use varargs, available since Java 5.0. These arguments must be all of the same type (or at least have a common super type), the varargs parameter must be the last parameter of the method, and there can be only one varargs parameter per method. Inside the method you treat the parameter as if it's an array. For instance:
Wim Vanni wrote:In what situation would you want that?
It is possible to have an undefined number of arguments if you make use of arrays (or collections).