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 |
Tags
- AWT
- mybatis
- 오버로딩
- 전화걸기
- 메서드
- Android
- Java
- layout
- 에러페이지
- Menu
- 안드로이드
- 배열
- OGNL
- paint
- 어노테이션
- Spring
- HTML
- 생성자
- Graphic
- 예외처리
- oracle
- 국제화
- Eclips
- 클래스
- 메소드
- 기본
- JSP
- struts2
- 이클립스
- JavaScript
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 |