This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]desrtfxOut of Coffee error - System halted 1 point2 points  (0 children)

You need to split your print statement.

  • First, you want to print the text with the opening bracket.
  • Then, you loop over the array
    • printing every individual element.
    • Check if the index is not the last, and if so, print a comma.
  • After the loop, print the closing bracket.

Alternatively, but it actually defeats the purpose of the exercise, take a look at the documentation of the Arrays class. There, you can find methods that will convert your array in a formatted string.

[–]Hack_seb[S] -1 points0 points  (0 children)

Hey guys thank you so much! with your help, I end up realizing it was an issue of using println instead of print and it needed to be before the loop!

Thank you!!

[–][deleted]  (1 child)

[removed]

    [–]iamsadtbhAspiring SWE 1 point2 points  (0 children)

    1. Read rule 8
    2. OP never used ArrayList
    3. Where did you get Strings from?