title: Write to file using ObjectOutputStream without overwriting old data
body: <p>I need to write strings on an file on eclipse without overwriting old strings. The function would be something like: create a string, save it on the file, create another string, save it on the file, this with several strings.</p>
  
  <p>The strings have the next format:</p>
  
  <pre><code>String one = name surname surname; value1 value2 value3; code
  </code></pre>
  
  <p>So the method will be: create string, save it on the file. Create another string, save it on the file, etc..
  Then after saving the wanted amount of strings on the file, I would need to read the file listing all the strings on the console.</p>
  
  <p><em>But for now, I only get to save one string on the file and then list it. If I save two strings, the second overwrites the first, and anyway, it doesn't it do right because returns me null value when I want to list them.</em></p>
  
  <p>This is the method which <strong>writes string on file</strong>:</p>
  
  <pre><code>public void writeSelling(List&lt;String&gt; wordList) throws IOException {
      fileOutPutStream = new FileOutputStream (file);
      write= new ObjectOutputStream (fileOutPutStream);
      for (String s : wordList){
          write.writeObject(s);
      }
      write.close();
  }
  </code></pre>
  
  <p>This is how I <strong>call write method on the main class</strong>:</p>
  
  <pre><code>    List&lt;String&gt; objectlist= new ArrayList&lt;String&gt;();
      objectlist.add(product); //Product is the string I save each time 
                               //which has the format I commented above
      writeSelling(objectlist);
  </code></pre>
  
  <p>This is the method which <strong>reads strings from file</strong>:</p>
  
  <pre><code>public ArrayList&lt;Object&gt; readSelling() throws Exception, FileNotFoundException, IOException {
      ArrayList&lt;Object&gt; objectlist= new ArrayList&lt;Object&gt;();
      fileInPutStream = new FileInputStream (file);
      read= new ObjectInputStream (fileInPutStream);
      for (int i=0; i&lt;contador; i++){
          objectlist.add(read.readObject());
      }
      read.close();
      return objectlist;
  }
  </code></pre>
  
  <p>And this is how I <strong>call read on the main class</strong>:</p>
  
  <pre><code>ArrayList sellingobjects;
  sellingobjects= readSelling();
  for (Iterator it = sellingobjects.iterator(); it.hasNext();) {
          String s = (String)it.next();
  }
  System.out.println(s.toString());
  </code></pre>