일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- profile
- context
- netsh
- Eclipse
- plugin
- Windows 10
- maVen
- vscode
- 단축키
- IntelliJ
- xargs
- Source
- grep
- Windows
- 줄바꿈 문자
- Mac
- tomcat
- port
- GIT
- resource
- bash
- import
- web.xml
- VirtualBox
- JavaScript
- ssh
- 네트워크
- lsof
- find
- Quartz
- Today
- Total
develog
try catch finally - Flow test 본문
public class TestMain {
public static void main(String[] args) {
String ret = null;
System.out.println();
System.out.println("-------------------test1");
ret = test1();
System.out.println("ret : " + ret);
System.out.println();
System.out.println("-------------------test2");
ret = test2();
System.out.println("ret : " + ret);
System.out.println();
System.out.println("-------------------test3");
ret = test3();
System.out.println("ret : " + ret);
}
private static String test1() {
System.out.println("start");
try {
System.out.println("try");
} catch (Throwable e) {
System.out.println("catch");
} finally {
System.out.println("finally");
}
System.out.println("end");
return "OK";
}
private static String test2() {
System.out.println("start");
try {
System.out.println("try");
throw new RuntimeException("[ERR]");
} catch (Throwable e) {
System.out.println("catch");
} finally {
System.out.println("finally");
}
System.out.println("end");
return "OK";
}
private static String test3() {
System.out.println("start");
try {
System.out.println("try");
return "OK1";
} catch (Throwable e) {
System.out.println("catch");
} finally {
System.out.println("finally");
}
System.out.println("end");
return "OK";
}
}
'Dev > Java' 카테고리의 다른 글
ant 에서 ssh 사용 (0) | 2012.12.01 |
---|---|
SQL Developer 에러 조치 (0) | 2012.11.27 |
Spring AOP (0) | 2012.11.24 |
[java] JSP (0) | 2012.11.14 |
[java] JSTL (0) | 2012.11.14 |