For Mr. Carlson
Me to collection agency: Your job is to collect money from me, not to be my financial counselor.
Collection agency: That's not very nice.
Collection agency: That's not very nice.
By logging in to LiveJournal using a third-party service you accept LiveJournal's User agreement
Select the code in which an ArrayIndexOutOfBoundsException occurs and is properly caught.
try { int intArray = new int[5]; arr[7] = 5; System.out.println(arr[7]); } finally { System.out.println("Finally Caught"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Caught"); }
try { int intArray = new int[5]; arr[7] = 5; System.out.println(arr[7]); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Caught"); } finally { System.out.println("Finally Caught"); }
int intArray = new int[5]; arr[7] = 5; System.out.println(arr[7]); catch (ArrayIndexOutOfBoundsException e) { System.out.println("Caught"); } finally { System.out.println("Finally Caught"); }
try { int intArray = new int[7]; arr[5] = 5; System.out.println(arr[7]); System.out.println("Finally Caught"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Caught"); }
Select the correct answer.
For those who aren't programmers, it's a trick question. I've highlighted in red the key to the trick.
( Collapse )