수업소개
자바에서 예외가 발생했을 때 이를 처리하는 방법을 소개합니다.
강의
소스코드
https://github.com/egoing/java-exception/commit/2812c9af98d93bc9039cf224f32a825ff4b15caa
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("잘못된 계산이네요.");
} catch(ArrayIndexOutOfBoundsException e){
System.out.println("없는 값을 찾고 계시네요 ^^");
}
System.out.println(5);
}
}

