Can I avoid such cumbersome try...catch block
<p>Usually, when dealing with Java IO code, here is what I wrote</p>

<pre><code>    FileOutputStream out = null;
    try
    {
        out = new FileOutputStream("myfile.txt");
        // More and more code goes here...
    }
    catch (Exception e)
    {
    }
    finally 
    {
        // I put the close code in finally block, to enture the opened
        // file stream is always closed even there is exception happened.
        if (out != null) {
            // Another try catch block, troublesome.
            try {
                out.close();
            } catch (IOException ex) {
            }
        }
    }
</code></pre>

<p>As you can see, while I try to close the file stream, I need to deal with another try...catch block.</p>

<p>Look troublesome :(</p>

<p>Is there any way I can avoid? I don't feel comfortable in putting the close code in non-finally block, as exception caused by other codes will make no chance for "close" being called.</p>
