Giving arrays as parameters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Giving arrays as parameters

How can i give to my program a set of parameters as array public class Program { public static join(String...args) { return args.length==0 ?"no parameters passed ": String.join("," args ); } }

6th Nov 2021, 11:11 AM
Rine
2 Answers
+ 5
I have put some code below that may be helpful https://code.sololearn.com/cK31e4GUFF9g/?ref=app
6th Nov 2021, 11:33 AM
Sâñtôsh
Sâñtôsh - avatar
+ 3
Here an example for unknown number of args: https://code.sololearn.com/cKI3TIvwylsV/?ref=app
6th Nov 2021, 12:57 PM
Coding Cat
Coding Cat - avatar