public class Test {
  public static void main(String[] args) {
    try {
      doSomething();
      System.out.println("yikes!");
    } catch (RuntimeException e) {
      System.out.println("got it.");
    }
  }
  
  public static void doSomething() {
    try {
      //Normally you would have code that doesn't explicitly appear 
      //to throw exceptions so it would be harder to see the problem.
      throw new RuntimeException();
    } finally {
      return;
    }
  }
}
I read this today and I though this was a really interesting corner case! The funny thing is that Eclipse IDE says that the finally block does not complete normally.
0 comments:
Post a Comment