Foo

public class Foo

{

    public static void method1 ()

    {

        System.out.println("Entering method1...");

        try

        {

            method2();

        }

        catch (Exception e)

        {

            System.out.println("Inside method1's catch block()...");

        }

        System.out.println("Leaving method1...");

    }

    

    private static void method2 () throws Exception

    {

        System.out.println("Entering method2...");

        

        try

        {

            if (1 == 1)

                throw new Exception();

            System.out.println("At the end of method2's try block...");

        }

        catch (Exception e)

        {

            System.out.println("Inside method2's catch block...");

            throw e;

        }

        finally

        {

            System.out.println("Inside method2's finally block...");

        }

        System.out.println("LEaving method2...");

    }

}

This page was last modified on 8/25/09