Arraylists and Flatfile Databases
<p>I am trying to make a program that saves a list of strings to a file and then reads them into an arraylist. Here is my current code.</p>

<pre><code>ObjectInputStream input = null;

    try {
        input = new ObjectInputStream(new FileInputStream("friends.txt"));
    } catch (FileNotFoundException e) {
        File f = new File("friends.txt");
        try {
            f.createNewFile();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    String obj;

    try {
        while ((obj = (String)input.readObject()) != null) {
            friendly.add(obj);
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
</code></pre>

<p>This returns a null pointer exception. I am not quite sure what is going wrong here.</p>
