// Allison Obourn // CSE 143 - lecture 9 // Reverses the contents of a file. import java.util.*; import java.io.*; public class ReverseFile { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("poem.txt")); reverseFile(input); } // prints out the reversed contents of the passed in Scanner // pre: input must not be null public static void reverseFile(Scanner input) { // implicitly: base case is empty file if(input.hasNextLine()) { String line = input.nextLine(); reverseFile(input); System.out.println(line); } } }