01.JAVA/Java
try-catch 로 왠만한 error 잡아내기
1010
2009. 6. 21. 04:47
반응형
class ThrowableTest {
public static void main(String[] args) {
try {
main(null);
} catch (Exception e) {
System.out.println("Exception");
} catch (StackOverflowError soe) {
System.out.println("StackOverflowError");
} catch (Error err) {
System.out.println("Error");
} catch (Throwable t) {
System.out.println("Throwable");
}
}
}
public static void main(String[] args) {
try {
main(null);
} catch (Exception e) {
System.out.println("Exception");
} catch (StackOverflowError soe) {
System.out.println("StackOverflowError");
} catch (Error err) {
System.out.println("Error");
} catch (Throwable t) {
System.out.println("Throwable");
}
}
}