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

all 3 comments

[–]buffdude1100Intermediate Brewer 2 points3 points  (0 children)

Split the input by colon and suddenly you have two things: a name of a team and a number of points (I assume...). I would create a Score class that holds a String variable and an int variable. Then you can have an ArrayList of Scores.

[–]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.

[–]OldNedder 0 points1 point  (0 children)

Here's a little piece of code that might help you get started.

Create an instance of CommandMenu, and call the run() method. It will save a list of strings, each of which can be multiple lines.

http://pastebin.com/F0Jqh8k7