Is there a way to simplify the try-catch block within another try-catch-finally block?
<p>I'm new to Java and is trying to learn the concept of catching exception. I saw this code online, and it has a try-catch block within the body of another try-catch-finally block. I was just wondering if there is any way to simplify the code so it can be written in a clearer manner?</p>

<pre><code>public static void main(String[] args) {
    Properties p1 = new Properties();
    OutputStream os1 = null;

    try {
        os1 = new FileOutputStream("xanadu123.properties");

        //set the properties value
        p1.setProperty("database", "localhost");
        p1.setProperty("1", "one");
        p1.setProperty("2", "two");

        p1.store(os1, "this is the comment");
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (os1 != null) {
            try {
                os1.close();
            } catch (IOException e){
                e.printStackTrace();
            }
        }   
    }
</code></pre>