What will be the output of the program?public class X { public static void main(String [] args) { try { badMethod(); System.out.print('A'); } catch (Exception ex) { System.out.print('B'); } finally { System.out.print('C'); } System.out.print('D'); } public static void badMethod() { throw new Error(); /* Line 22 */ } } - Study24x7
Social learning Network
study24x7

Default error msg

Login

New to Study24x7 ? Join Now
Already have an account? Login
23 Feb 2023 04:45 PM study24x7 study24x7

What will be the output of the program?public class X { public static void main(String [] args) { try { badMethod(); System.out.print("A"); } catch (Exception ex) { System.out.print("B"...

See more

A

ABCD

B

Compilation fails.

C

C is printed before exiting with an error message.

D

BC is printed before exiting with an error message.

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles