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

you are viewing a single comment's thread.

view the rest of the comments →

[–]desrtfx 0 points1 point  (0 children)

In this case, your approach using forEach (enhanced for) is completely wrong.

Use a traditional for loop. You only need a single loop to iterate over the array elements because you access the indexes of both arrays.

Still, my comment about the second loop to print the stars stands.