I'm what I am trying to do is saving all the scores of a game, but it seems like it's just overwriting the first line and not adding them to the next line. I need your help! Thank you in advance!
System.out.print("Enter Your Name: ");
String name = inputName.nextLine();
try {
File highscore = new File("highscore.txt");
PrintWriter output = new PrintWriter(highscore);
if (highscore.exists()) {
System.out.println("Score has been saved!");
}
output.println(name + " - " + score);
output.close();
} catch (IOException e) {
System.out.println(e);
}
}