import java.util.*; import java.io.*; /* * Connor Moore * June 20, 2016 * * Parses a file, and reprints all lines in the file in reverse. */ public class FileParser { public static void main(String[] args) throws FileNotFoundException { // Uses a stack, a super convenient structure for reversing things. Stack linesStack = new Stack(); Scanner input = new Scanner(new File("data.txt")); while (input.hasNextLine()) { linesStack.push(input.nextLine()); } while (!linesStack.isEmpty()) { System.out.println(linesStack.pop()); } } }