Behavior of nested finally in Exceptions
<p>Today at work, I had to review a code snippet that looks similar to this mock example.</p>

<p><code>
    package test;</p>

<pre><code>import java.io.IOException;
import org.apache.log4j.Logger;

public class ExceptionTester {

    public static Logger logger = Logger.getLogger(ExceptionTester.class);

public void test() throws IOException {
    new IOException();
}

public static void main(String[] args) {
    ExceptionTester comparator = new ExceptionTester();
    try {
        try {
            comparator.test();
        } finally {
            System.out.println("Finally 1");
        }
    } catch(IOException ex) {
        logger.error("Exception happened" ex);
            // also close opened resources
    } 
    System.out.println("Exiting out of the program");
}
</code></pre>

<p>}
</code></p>

<p>It's printing the following output.I expected an compile error since the inner <code>try</code> did not have a <code>catch</code> block.</p>

<pre>
Finally 1
Exiting out of the program
</pre>

<p>I do not understand why <code>IOException</code> is caught by the outer <code>catch</code> block. I would appreciate if anyone can explain this, especially by citing stack unwinding process</p>
