Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of the three dots in a method declaration? [duplicate]

Tags:

java

string

Possible Duplicate:
Java, 3 dots in parameters

public static void getImages(String... folders) throws IOException{

}

In the above getImages() method, why there is three dots. What is it mean? I searched google but couldn't find anything.

like image 294
Isuru Avatar asked May 15 '11 19:05

Isuru


1 Answers

Yeah, punctuation is hard to search for if you don't know the technical term. In this case, it is varargs. Here is a nice link to explain it. Basically, the caller can add as many arguments as desired, and the method sees them arriving as an array of that length.

like image 80
Kilian Foth Avatar answered Oct 14 '22 10:10

Kilian Foth