Dev/Java

try catch finally - Flow

냐옴 2012. 4. 26. 17:35

Java

-------------------------------------

public static void exceptionTest() {

    System.out.println("1");

    

    try {

        System.out.println("2");

        throwException(); // 예외발생!

        System.out.println("3");

    } catch (Exception e) {

        System.out.println("4");

    } finally {

        System.out.println("5");

    }

    

    System.out.println("6");

}


결과

-------------------------------------

1

2

4

5

6