Multiple choice

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() {} }

  1. AC

  2. BC

  3. ACD

  4. ABCD

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

There is no exception thrown, so all the code with the exception of the catch statement block is run.