Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void saveToFile(LeaderBoard playerScore){
- StringJoiner joiner = new StringJoiner("|");
- joiner.add(playerScore.playerName)
- .add(playerScore.date)
- .add(playerScore.guessTime)
- .add(playerScore.guessTries)
- .add(playerScore.word)
- .add("\n");
- String joinedString = joiner.toString();
- try (PrintWriter out = new PrintWriter(new FileOutputStream(new File ("highscores.txt"), true));){
- out.append(joinedString);
- }catch(Exception e){
- System.out.println("File not found :( ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement