5 ms·
> Java Varargs functions can take spreaded arrays as Var parameters That's syntactic sugar for an array, in the most literal way possible: when you define `fun
by masklinn 6y ago
> Java Varargs functions can take spreaded arrays as Var parameters
That's syntactic sugar for an array, in the most literal way possible: when you define `func(Object… args)` the actual bytecode is that of `func(Object[] args)`, and you can pass in an array to stand in for the entire varargs.
So no, they're right. The varags just counts as 1 formal parameter.
- jdmichal 6y agoYep! One can even define the `main` method using either: public static void main(String[] args) public static void main(String... args)