Exception Handling

25. Program

//Find what it gives ?

Compiletion Error / Compiletion Successfully / Run Time Error / Output class F { public static void main(String[] args) { System.out.println(1); int i = 10/0; System.out.println(2); } }

26. Program

//Find what it gives ?

Compiletion Error / Compiletion Successfully / Run Time Error / Output class G { public static void main(String[] args) { System.out.println(1); test(); System.out.println(2); } static void test() { System.out.println(3); try { int i = 10/0; } catch(ArithmeticException ex) { System.out.println(4); } System.out.println(5); } }

27. Program

//Find what it gives ?

Compiletion Error / Compiletion Successfully / Run Time Error / Output class I { public static void main(String[] args) { System.out.println(1); try { test(); } catch(ArithmeticException ex) { System.out.println("Exception"); } System.out.println(2); } static void test() { System.out.println(3); int i = 10/0; System.out.println(4); } }

28. Program

//Find what it gives ?

Compiletion Error / Compiletion Successfully / Run Time Error / Output //Run class X class J { void test1() { System.out.println(1); K k1 = new K(); k1.test2(); System.out.println(2); } } class K { void test2() { System.out.println(3); try { L l1 = new L(); l1.test3(); } catch(NumberFormatException ex) { System.out.println("ex"); } System.out.println("4"); } } class L { void test3() { System.out.println(5); int i = Integer.parseInt("abc"); System.out.println(6); } } class X { public static void main(String[] args) { System.out.println(7); J j1 = new J(); j1.test1(); System.out.println(8); } }

Page....