


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



67
68
70
71
72
75
// Return maximum element in A[i..j] int findMax(int[] A, int i, int j) { ... }
77
84
try { if (i == 0) return; myMethod(a[i]); } catch (ArrayIndexOutOfBounds e) { System.out.println(“a[] out of bounds”); } catch (MyOwnException e) { System.out.println(“Caught my error”); } catch (Exception e) { System.out.println(“Caught” + e.toString()); throw e; } finally { /* stuff to do regardless of whether an exception / / was thrown or a return taken */ } 85
while ((s = ...) != null) { try { FileInputStream f = new FileInputStream(s); ... } catch (FileNotFoundException e) { System.out.println(s + “ not found”); } } 86
Throwable Error Exception RuntimeException Checked Unchecked 89