Question
Option 4 : AC
Detailed Solution
सही उत्तर AC है।
Question:
Consider the Java fragment: try { int[] a = new int[2]; a[5] = 10; } catch (ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch (Exception e) { System.out.print("B"); } finally { System.out.print("C"); } What is printed? / Java कोड खंड पर विचार करें: try { int[] a = new int[2]; a[5] = 10; } catch (ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch (Exception e) { System.out.print("B"); } finally { System.out.print("C"); } क्या मुद्रित होगा?
Correct Answer: AC
a[5] throws ArrayIndexOutOfBoundsException, caught by the first catch (A); the more general catch is skipped, and finally always runs (C), giving AC. / a[5] से ArrayIndexOutOfBoundsException फेंका जाता है, जो पहले catch (A) से पकड़ा जाता है; सामान्य catch छूट जाता है, और finally सदैव चलता है (C), अतः AC।