Java: new Something().method() vs a temp variable
<p>maybe it's dumb but is there a difference between</p>

<pre><code>new Something().method();
</code></pre>

<p>and </p>

<pre><code>Something tmpSomething = new Something();
tmpSomething.method();
</code></pre>

<p>as I was calling only one method on this particular object, I chose the first solution but I'm not sure that this is exactly the same behavior...</p>

<p>I just want to mention the constructor initializes a Writer and method writes in this file...</p>
