How does Java allocate memory differently for an object declared in a constructor and an object named by a variable?
<p>Using Java IO streams, it is quite often we use objects solely as constructors for other objects. I am interested in the memory implications of this prospect. For example, how does memory allocation differ in these two statements that do the same thing?</p>

<pre><code>FileInputStream inputFile = new FileInputStream("filepath");
Scanner inStream = new Scanner(inputFile);
</code></pre>

<p>and </p>

<pre><code>Scanner inStream = new Scanner(new FileInputStream("filepath"));
</code></pre>
