Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot

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 RuntimeException and its subclasses, and the class Error and its subclasses. All other exception classes are checked exception classes.

...

Code Block
bgColor#FFcccc
public class StackOverflow {
  public static void main(String[] args) {
    infiniteRun();
    System.out.println(""Continuing..."");
  }
    
  private static void infiniteRun() {
    infiniteRun();
  }
}

...

Code Block
bgColor#ccccff
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