 File f = new File("actions.txt"); try{     Scanner scanner = new Scanner(f);     while (scanner.hasNextLine()) {         String line = scanner.nextLine();         System.out.println(line);     }     scanner.close(); } catch (FileNotFoundException e) {     e.printStackTrace(); } System.exit(0); // terminate the program 