| Wiki Markup |
|---|
According to the Java Language Specification \[[JLS 05|AA. Java References#JLS 05]\] section 11.2 ""Compile-Time Checking of Exceptions"": |
The unchecked exceptions classes are the class
RuntimeExceptionand its subclasses, and the classErrorand its subclasses. All other exception classes are checked exception classes.
...
| Code Block | ||
|---|---|---|
| ||
public class StackOverflow {
public static void main(String[] args) {
infiniteRun();
System.out.println(""Continuing..."");
}
private static void infiniteRun() {
infiniteRun();
}
}
|
...
| Code Block | ||
|---|---|---|
| ||
public class StackOverflow {
public static void main(String[] args) {
try {
infiniteRun();
} catch(Throwable t) {
System.out.println(""Handling error..."");
// Log error to file
} finally {
// Free cache, release resources
}
System.out.println(""Continuing..."");
}
private static void infiniteRun() {
infiniteRun();
}
}
|
...
EXC02-J. Prevent exceptions while logging data 13. Exceptional Behavior (EXC) EXC04-J. Prevent against inadvertent calls to System.exit() or forced shutdown