// CSE 143, Autumn 2013 // Code written in lecture to reverse a file. // We will fix this code in Friday's lecture. import java.io.*; import java.util.*; public class ReverseFile { public static void main(String[] args) throws FileNotFoundException { String[] allWords = new String[1000]; int count = 0; Scanner input = new Scanner(new File("poem.txt")); while(input.hasNext()) { String word = input.next(); allWords[count] = word; count++; } for(int i = count - 1; i >= 0; i--) { System.out.println(allWords[i]); } } }