Java/2012.04 강좌
12일차 Exception(예외 처리 기본)
Bohemian life
2012. 4. 19. 11:07
package hi.choongang; public class P261Exam { public static void main(String[] args) { System.out.println("시작"); throwException();//메서드 호출 System.out.println("정상종료"); } public static void throwException(){ try{ System.out.println("내가 직접 예외를 발생시키겠다."); throw new Exception("내가 예외를 발생시킴!"); //System.out.pritnln("~~~~~"); }catch(Exception e){ System.out.println("예외가 발생하여 캐치문으로 왔음"); } } }