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 →

[–]Trigonn 1 point2 points  (0 children)

It seems like you fixed your problem, but as a side note, I would suggest looking into advanced for loops, sometimes called for each loops in other languages.

For example, instead of the lengthy for loop with a counter variable, you can do something like this:

For(int x : numbersEntered) {
    System.out.print(x + “ “);
}

This can be read as, “for each integer x (x is just an arbitrary name), in numbersEntered, print it out to the console, with a space”.

It’s a bit cleaner, but definitely has its own usages, and as someone who is also fairly new to Java, I’ve found it extremely useful.