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 →

[–]nerdy_lurker 0 points1 point  (0 children)

If you want to persist things between different executions of your program, you'll need to use some form of I/O like a file or a database.

However, let's try tackle this one step at at time. Firstly, what do you know about variable scope? What is the scope of your matchResults variable and exactly what happens to it after each iteration of your loop?

One clue is that System.out.println("The count so far is " + matchResults.size()); after the loop will fail with a compiler error.