수업소개
catch 문의 매개변수에 대해서 자세히 살펴봅니다.
강의
소스코드
https://github.com/egoing/java-exception/commit/761f08795f7c9227842656da4847b36c7c70d93f
public class ExceptionApp {
public static void main(String[] args) {
System.out.println(1);
int[] scores = {10,20,30};
try {
System.out.println(2);
// System.out.println(scores[3]);
System.out.println(3);
System.out.println(2 / 0);
System.out.println(4);
} catch(ArithmeticException e){
System.out.println("계산이 잘못된 것 같아요."+e.getMessage());
e.printStackTrace();
} catch(Exception e){
System.out.println("먼가 이상합니다. 오류가 발생했습니다. ");
}
System.out.println(5);
}
}

