TryFinishes
DRAFT
Observed

TryFinishes
Incorrect

Exceptions get thrown at the end of the try block

Correct

Exceptions get thrown immediately when they occur

Correction
Here is what's right.

Wherever an exception happens, execution stops immediately (it does not first continue until the end of a try block), and Java looks for a catch block to handle that exception.

Here is an example:

public void swapElement(int[] a, int[] b, int i) {
  try {
    int temp = a[i];
    a[i] = b[i];
    b[i] = temp;
  } catch (ArrayIndexOutOfBoundsException ex) {
    System.err.println("Index i out of bounds of one of the given arrays");
  }
}

In the above code, if i>=a.length, the line int temp = a[i] throws an exception and the next two lines do not execute: control skips from a[i] (which throws an ArrayIndexOutOfBoundsException) directly to the catch block that catches the ArrayIndexOutOfBoundsException).