Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Java
- layout
- 배열
- AWT
- 오버로딩
- 국제화
- 메소드
- Graphic
- 클래스
- OGNL
- 전화걸기
- Spring
- 이클립스
- 메서드
- JSP
- 기본
- oracle
- 에러페이지
- 예외처리
- Eclips
- HTML
- struts2
- 안드로이드
- paint
- Menu
- Android
- JavaScript
- 생성자
- 어노테이션
- mybatis
Archives
- Today
- Total
note
예외처리 finally 사용법 본문
package com.basic;//예외처리 finally의 사용방법
public class ExceptionEx6 {
public static void main(String[] args){
System.out.println("==예외가 발생하지 않은 경우==");
System.out.println("1");
try{
System.out.println("2");
System.out.println("3");
}catch(Exception e){
System.out.println("4");
}finally{//예외가 있던 없던 무조건 실행됨
System.out.println("5");
}
System.out.println("프로그램 종료");
}
}
==예외가 발생하지 않은 경우==
1
2
3
5
프로그램 종료
package com.basic;//예외처리 finally의 사용방법
public class ExceptionEx7 {
public static void main(String[] args){
System.out.println("==예외가 발생한 경우==");
System.out.println("1");
try{
System.out.println("2");
System.out.println(7/0);
System.out.println("3");
}catch(Exception e){
System.out.println("4");
}finally{//예외가 있던 없던 무조건 실행됨
System.out.println("5");
}
System.out.println("프로그램 종료");
}
}
==예외가 발생한 경우==
1
2
4
5
프로그램 종료
'자바 > 예외처리' 카테고리의 다른 글
예외처리 throws 사용법 (0) | 2011.12.26 |
---|---|
예외처리 다중 catch문 사용하기 (0) | 2011.12.26 |
예외처리 5 (0) | 2011.12.26 |
예외처리 기본4 (0) | 2011.12.26 |
예외처리 기본3 (0) | 2011.12.26 |