Exception Handling

23. Program

//Find Simply which method gives Compile Time Error ?

For Ex:- Method test1 will not give Error ! Now check other. class C { public static void main(String[] args) { //1 int test1() { try { //Something } catch(ArithmeticException ex) { } catch(NullPointerException ex) { } return 10; } //2 int test2() { try { //Something return 10; } catch(ArithmeticException ex) { return 20; } catch(NullPointerException ex) { return 30; } } //3 int test3() { try { //Something } catch(ArithmeticException ex) { return 100; } catch(NullPointerException ex) { return 30; } } //4 int test4() { try { //Something } catch(NullPointerException ex) { return 40; } catch(ArithmeticException ex) { return 20; } return 100; } //5 int test5() { try { //Something } catch(ArithmeticException ex) { return 20; } catch(NullPointerException ex) { } } //6 int test6() { try { //Something } catch(ArithmeticException ex) { return 200; } catch(NullPointerException ex) { } return 50; } //7 int test7() { try { //Something return 1; } catch(ArithmeticException ex) { return 2; } catch(NullPointerException ex) { return 3; } return 4; }

Page....