220. 사용자 정의 예외 상속과 catch 순서
다음 Java 프로그램의 실행 결과를 쓰시오.
1class BaseEx extends Exception {}23class SubEx extends BaseEx {}45public class Main {6static void check(int n) throws BaseEx {7if (n == 1) throw new SubEx();8if (n == 2) throw new BaseEx();9}1011public static void main(String[] args) {12for (int i = 0; i < 3; i++) {13try {14check(i);15System.out.print("N");16} catch (SubEx e) {17System.out.print("S");18} catch (BaseEx e) {19System.out.print("B");20} finally {21System.out.print(i);22}23}24System.out.println();25}26}