title: Initializing FileOutputStream inside ObjectOutputStream without making FileOutputStream its own Object
body: <p>Does it cause any issues or draw backs (performance hit, memory leak, etc.) to initialize an ObjectOutputStream with</p>
  <p><code>ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(highScorePath));</code></p>
  <p>vs.</p>
  <pre><code>FileOutputStream fos = new FileOutputStream(highScorePath);
  ObjectOutputStream oos = new ObjectOutputStream(fos);
  </code></pre>
  <p>Part of me wants to go with the top one because you do not have to have two separate variables for something that is only going to serve one purpose. But at the same time, I want to go with the bottom one, since in order to free up resources, you must explicitly call <code>.close()</code> on both <code>fos</code> and <code>oos</code>. What I am not sure about is if I went with the top option and called <code>oos.close()</code>, would that also properly close the <code>FileOutputStream</code>, or would that cause a memory leak?</p>