Java speed and memory occupation "contest"
<p>I have a general question about Java.</p>

<p>What is better?</p>

<p>case 1:</p>

<pre><code>a = method1(7);
b = method2(a);
c = method3(b);
</code></pre>

<p>or</p>

<pre><code>c = method3(method2(method1(7)));
</code></pre>

<p>case 2:</p>

<pre><code>String a = method1(1);
String b = method2(2);
String c = method3(3);
String d = a+b+c;
</code></pre>

<p>or</p>

<pre><code>String d = method1(1)+method2(2)+method3(3);
</code></pre>

<p>I was wondering what would be better speed-wise...
I guess the second way (on both) is better memory occupation-wise, but I always wondered if one was faster than the other or if they take same amount of time to execute. I'm making a program that calls the same function many times, so every milisecond counts!</p>

<p>If there is another category in which they can compete (except speed, etc.), tell me too!</p>
