Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

varargs java

varargs:
It's possible to pass an arbitrary number of the same type arguments to 
a method using the special syntax named varargs (variable-length arguments).
 (Varargs can be used when we are unsure about the number of 
 arguments to be passed in a method)
Use varargs for any method (or constructor) that needs an array of
T (whatever type T may be) as input
One good example is String.format.
The format string can accept any number of parameters.
 
PREVIOUS NEXT
Tagged: #varargs #java
ADD COMMENT
Topic
Name
8+8 =