I'm trying to split an array. Any ideas what could be an effective way to do it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm trying to split an array. Any ideas what could be an effective way to do it?

How can I split the teams and be able to select them individually by using their index on the on the array? Example: Manchester United Arsenal Orlando Pirates Manchester City... Please see the below code! https://code.sololearn.com/cC4sYmFxAIQ3/?ref=app

22nd Sep 2017, 3:30 PM
Sibusiso Mbambo
6 Answers
+ 11
Change your last line to for (String s: matches) System.out.println(s);
22nd Sep 2017, 4:03 PM
Tashi N
Tashi N - avatar
+ 8
As for the second code... you can't use the enhanced for loop over a String (games must be replaced by a collection to use enhanced for loop).
22nd Sep 2017, 4:05 PM
Tashi N
Tashi N - avatar
+ 7
You're welcome :D
22nd Sep 2017, 4:23 PM
Tashi N
Tashi N - avatar
+ 2
"Change your last line to for (String s: matches) System.out.println(s);" YOU MADE MY DAY, THANK YOU.
22nd Sep 2017, 4:19 PM
Sibusiso Mbambo
+ 1
22nd Sep 2017, 3:30 PM
Sibusiso Mbambo
0
yes it did. thanks for your contribution though
22nd Sep 2017, 5:07 PM
Sibusiso Mbambo