Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
class TryFinally {
  private static boolean doLogic() {
    try {
      throw new IllegalStateException();
    } finally {
      System.out.println("logic done");
    }
    // Any return statements must go here; 
    // applicable only when exception is thrown conditionally
  }
}

Exceptions

ERRO4-J-EX0: Control flow statements whose destination is within the finally block are perfectly acceptable. For example, the following code does not violate this rule because the break statement exits within the while loop but not within the finally block:

...