What is the difference between void method(String[] a)and void method(String... a)?
The first method takes an array of strings, where, since the second method takes one or more String arguments. What are the various features that they provide?
Also, I don't know why, but this works:
public class Test {
public static void main(String[] args) {
String[] a = {"Hello", "World"};
Test t = new Test();
t.method(a);
}
void method(String...args) {
System.out.println("Varargs");
}
}
source
share