Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. private static String highscorFile = System.getenv("USERPROFILE") + "/Desktop/Snake_Highscore.txt";
  2. private String GetHighscore() throws IOException {
  3.         File file = new File(highscorFile);
  4.         String j = "";
  5.         if (file.exists()) {
  6.             Scanner scanner = new Scanner(file);
  7.             while(scanner.hasNextLine()) {
  8.                 String zeile = scanner.nextLine();
  9.                 if (zeile.equalsIgnoreCase("")
  10.                         || zeile == null) {
  11.                     break;
  12.                 }
  13.                 j = zeile;
  14.             }
  15.             scanner.close();
  16.             return j;
  17.         }
  18.         return "0";
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement