title: Is it possible to write to the same file from different methods?
body: <p>I have the following method:</p>
  
  <pre><code>public static void writeContestantsToFile(ArrayList&lt;Contestant&gt; contestants) throws IOException {
      FileOutputStream fos = new FileOutputStream("minos.dat");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
  
      oos.writeObject(contestants);
      oos.flush();
      oos.close();
  }
  </code></pre>
  
  <p>But I am wondering whether or not I can write to the file minos.dat again with another arraylist? For example have another method like this:</p>
  
  <pre><code>public static void writeContestantsToFile(ArrayList&lt;Times&gt; times) throws IOException {
      FileOutputStream fos = new FileOutputStream("minos.dat");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
  
      oos.writeObject(times);
      oos.flush();
      oos.close();
  }
  </code></pre>
  
  <p>Will I be able to retrieve both the times arraylist and contestants? Or do I need to write to separate files?</p>