ObjectInputStream[Java]
<p>i'm new to file i/o so i'm sorry if this is a pretty bad question.</p>

<p>Currently I have an add method/main method and a person class my outputstream is working fine in the add method: This is at the top of the method</p>

<pre><code>       FileOutputStream myFile = null;
        try {
            myFile = new FileOutputStream("txt123.txt");
        } catch (FileNotFoundException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }
        ObjectOutputStream oos = null;
        try {
            oos = new ObjectOutputStream(myFile);
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
</code></pre>

<p>And I then have this twice because there are two types of people that can be added</p>

<pre><code>oos.writeObject(person);
oos.close();
System.out.println("Done");
</code></pre>

<p>So my question, how do i get the input working and finally where do i put it, in the add method or the main method, I read how to do what i done here: <a href="http://www.mkyong.com/java/how-to-write-an-object-to-file-in-java/" rel="nofollow">http://www.mkyong.com/java/how-to-write-an-object-to-file-in-java/</a></p>

<p>He also has a guide on reading in the objects but I cant seem to get it working</p>

<ul>
<li>Thanks!</li>
</ul>
