I'm having problems remembering how to fill an ArrayList and I can't seem to find how to do it. I want to use it to keep a HighScore. I currently have a Matrix for that, it looks like this:
if(score>record){
System.out.println("Congrats, high score! Please type your name:");
String name=sc.next();
highScore[1][0] = name;
highScore[0][0] = ("Player");
record=score;
highScore[0][1]=("Current");
highScore[1][1]=(score+"");
highScore[0][2]=("Highest");
highScore[1][2]=(record+"");
}
I want to use a list because the display will be the same and I can add as many high scores as I want. If you can tell me how to do it, or any other method it would be great.