Java Variable Length Parameter vs. Array, Simply Syntactic Sugar? - Stack Overflow
The '...' parameters you are talking about are called varargs.
Some differences to note:
- varargs can be passed no parameters (basically ignored), null, or an indeterminate number of arguments, while array parameters must be passed an array or null
- varargs must be the last parameter of your method, whereas it doesn't matter for array parameters. This is because of this special property of varargs, which is probably the most significant difference between the two things you posted:
Read full article from Java Variable Length Parameter vs. Array, Simply Syntactic Sugar? - Stack Overflow
No comments:
Post a Comment