java – String … whats do String … mean
•
Java
I want to figure out some java code
private static object [] methodName(NodeList nodes,String... Names)
What is an operator?
Thank you. Sorry, some searches can't be found elsewhere
Solution
This is a varargs declaration
It says you can call the method with 0 or more string parameters as final parameters Substitute:
write(new String[]{"A","B","C"});
You can use
write("A","C");
So each string is a different parameter Then you can iterate over them, for example
public void write(String... records) { for (String record: records) System.out.println(record); }
More examples here
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码