If i use ellipsis in main method would it make any difference?
public static void main(String... args) {
}
No difference. That "ellipsis" syntax is called varargs, whose parameter type is actually an array.
This means there are actually three possible signatures of a valid main()
method:
public static void main(String[] args) {}
public static void main(String... args) {}
public static void main(String args[]) {}
It does not make any difference, since the JVM turns the ellipsis (also called "varargs") into an array at "compile" time:
void myMethod(final X... args)
is exactly the same as
void myMethod(final X[] args)
or (less frequent)
void myMethod(final X args[])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With