Hello, I have come across a new style of variables when using the FileNameExtensionFilter class. The constructor that I use has 2 String-type parameters, only the second one is different from the ones I already know, it admits a set of String-type variables.
public void metodo(String str, String... Strs)
Could you give me information about that style of parameter?
It is called
varargs
,...
, it indicates thatn
(multiple) parameters of type String can arrive. In this case an array of strings.for instance:
You can call the method in different ways:
More information: Varargs