开发者

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

开发者 https://www.devze.com 2023-03-05 21:14 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Java, 3 dots in parameters
This question already has answers here: Closed 11 years ago.

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 me开发者_运维百科an? I searched google but couldn't find anything.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消