Outputing the contents of an array list
<p>How would it be possible to return the values in the arraylist onto the screen e.g. System.out.println</p>

<p>I was thinking of a for loop e.g.</p>

<pre><code>for (String s : list)
{
    System.out.println(s);
}
</code></pre>

<p>But it complains it can't convert an object to string - how can I convert it to string?</p>

<p><strong>Code:</strong></p>

<pre><code>public static void GetStatsProc(String operation)
{
     try { 
        Process p=Runtime.getRuntime().exec(operation); 
        p.waitFor(); 
        BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream())); 
        String line=reader.readLine(); 
        while(line!=null) 
        { 
            // Add all lines into an array
            ArrayList list = new ArrayList();
            list.add(line);
            System.out.println(line); 
            line=reader.readLine(); 
        } 

     }
     catch(IOException e1) {}
     catch(InterruptedException e2) {}   
}
</code></pre>
