Holding output without printing till program termination
<p>Is there a way to hold the output without printing and finally print it out when the program terminates ? </p>

<p>For example </p>

<pre><code>BufferedReader br = new BufferedReader(new InputStreamReader(System.in));       
int t= Integer.parseInt(br.readLine());
for (int tc=0;tc&lt;t;tc++)
{
   String st = br.readLine();
   int len= st.length();
   System.out.println(len); //I don't want this to be printed on screen till the for loop terminates
}
</code></pre>

<p>The output for the code would be</p>

<pre><code>2
abcd
4
aac
3
</code></pre>

<p>while what I want is</p>

<pre><code>2
abcd
aac
4
3
</code></pre>

<p>Is it possible to get this?</p>

<p>Thanks.</p>
