2 public static void main(String[] argv) {
4 System.out.print("throw Exception: ");
6 System.out.println("failed.");
7 } catch (Exception e) {
8 System.out.println("passed.");
12 System.out.print("native Exception: ");
13 System.arraycopy(null, 1, null, 1, 1);
14 System.out.println("failed.");
15 } catch (Exception e) {
16 System.out.println("passed.");
20 System.out.print("NullPointerException: ");
23 System.out.println("failed.");
24 } catch (NullPointerException e) {
25 System.out.println("passed.");
29 System.out.print("ArithmeticException: ");
30 int i = 1, j = 0, k = i / j;
31 System.out.println("failed.");
32 } catch (ArithmeticException e) {
33 System.out.println("passed.");
37 System.out.print("ArrayIndexOutOfBoundsException: ");
38 int[] ia = new int[1];
40 System.out.println("failed.");
41 } catch (ArrayIndexOutOfBoundsException e) {
42 System.out.println("passed.");
46 System.out.print("NegativeArraySizeException: ");
47 int[] ia = new int[-1];
48 System.out.println("failed.");
49 } catch (NegativeArraySizeException e) {
50 System.out.println("passed.");
54 System.out.print("ClassCastException: ");
55 Object o = new Object();
58 System.out.println("failed.");
59 } catch (ClassCastException e) {
60 System.out.println("passed.");
63 System.out.println("NullPointerException (without catch): ");
66 System.out.println("failed.");
69 public synchronized static void sub() throws Exception {
74 public static void sub2() throws Exception {
78 public synchronized static void sub3() throws Exception {
82 public static void sub4() throws Exception {
83 throw new Exception();