方法声明中三个点的含义是什么? [英] What is the meaning of the three dots in a method declaration?
本文介绍了方法声明中三个点的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
Java,3个参数点
public static void getImages(String... folders) throws IOException{
}
在上面的 getImages()
方法中,为什么有三个点。这是什么意思?我搜索谷歌但找不到任何东西。
In the above getImages()
method, why there is three dots. What is it mean? I searched google but couldn't find anything.
推荐答案
是的,如果你不知道标点符号很难搜索技术术语。在这种情况下,它是 varargs 。 这里是一个很好的链接来解释它。基本上,调用者可以根据需要添加任意数量的参数,并且该方法将它们视为该长度的数组。
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.
这篇关于方法声明中三个点的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文