+ 1
In this method, what does mean the "...k" ?
Static int sum ( int ...k){ Int sum = 0; for ( int i:k) sum +=i; Return sum; }
3 Réponses
+ 2
It is called variable arguments or varargs in short. It behaves like an array and nothing more.
See if this helps-
https://code.sololearn.com/cd3JmZlxH7NR/?ref=app
+ 4
Hichem GOUIA
As Avinesh mentioned it is called varargs. The method accepts arrays but also arguments (which get treated like arrays)