Printing to File - Java beginner
<p>I cannot figure out why the following simple program doesn't (create) and then write to a file? Can you spot where the problem is?</p>

<pre><code>public class RandomSeq
{
    public static void main( String[] args)
    {
        // command-line argument
        int N = Integer.parseInt( args[0] );

        // generate and print N numbers between 0 and 1
        for ( int i = 0 ; i &lt; N; i++ )
        {
            // System.out.println( Math.random() );
            StdOut.println( Math.random() );
        }
    }
}
</code></pre>

<p>When I type the following at the Interactions prompt:</p>

<blockquote>
  <p>java RandomSeq 5</p>
</blockquote>

<pre><code>0.9959531649155268
0.5010055704125982
0.4444779637605908
0.4205901267129799
0.09968268057133955
</code></pre>

<p>I obviously get the correct output, but when I use piping, it doesn't do what (I think) it should do:</p>

<pre><code>&gt; java RandomSeq 5 &gt; f1.txt
</code></pre>
