why isn't the input text file being read into the ArrayList<String>, diary?
<p>Here's my code:</p>

<pre><code>public void readFile() throws IOException {
    System.out.println("Input file name: ");
    Scanner in = new Scanner(System.in);
    String readName = in.nextLine();
    Scanner reader = new Scanner(new File(readName));
    System.out.println("Reading file...");
    while (reader.hasNextLine()) {
        System.out.println(reader.nextLine());
    }
    System.out.println("File read.");
    Scanner inAgain = new Scanner(System.in);
    System.out.println("Would you like to read this into the current Diary?");
    System.out.println("Warning: This will overwrite your current Diary!");
    String readFileConfirm = inAgain.nextLine();
    ArrayList&lt;String&gt; readData = new ArrayList&lt;String&gt;();
    if (readFileConfirm.equalsIgnoreCase("yes")) {
        for (int i = 0; i &lt; readData.size(); i++) {
            readData.add(reader.nextLine());
        }
        System.out.println("Data added to extra array...");
        System.out.println("Here are the contents.");
        for (int i = 0; i &lt; readData.size(); i++) {
            System.out.println(readData.get(i));
        }
        System.out.println("Contents read.");
        System.out.println("Now overwriting current Diary with read file...");
        diary.clear();
        for (int i = 0; i &lt; diary.size(); i++) {
            diary.add(readData.get(i));
        }
        System.out.println("New Diary created!");
        System.out.println("Use 'recall' to see your new Diary!");
    } else {
        System.out.println("Very well, returning to first command entry.");
    }
}
</code></pre>

<p>Thanks in advance!</p>

<p>-h</p>
