关于JAVA中数据类型是(...)的疑问
public String method(String ... strings){
}
请问个位大侠,String ... 这个表示什么意思?在哪里能找到点资料看看?
希望高手指点?特此感谢不尽!
[解决办法]
裡面的就是參數啊。。。
[解决办法]
这个表示,参数的个数不确定,和用数组是一样的,在SUN 的网站有介绍
----
http://java.sun.com/docs/books/tutorial/java/javaOO/arguments.html
----
Arbitrary Number of Arguments
You can use a construct called varargs to pass an arbitrary number of values to a method. You use varargs when you don 't know how many of a particular type of argument will be passed to the method. It 's a shortcut to creating an array manually (the previous method could have used varargs rather than an array).
To use varargs, you follow the type of the last parameter by an ellipsis (three dots, ...), then a space, and the parameter name. The method can then be called with any number of that parameter, including none.