What will be the result of compiling and running the given program? Select one correct answer. 1 public class exception 2 { 3 public static void main(String args[]) 4 { 5 System.out.println("A"); 6 try 7 { 8 System.out.println("B"); 9 System.exit(0); 9 } 10 catch(Exception e) 11 { 12 System.out.println("C"); 13 } 14 finally 15 { 16 System.out.println("D"); 17 } 18 } 19 }

  1. Program compiles correctly and prints "A" and "C" when executed

  2. Program compiles correctly and prints "A" when executed

  3. Program compiles correctly and prints "A","B" and "C" when executed

  4. Program compiles correctly and prints "A" and "B" when executed

  5. compile-time error

  6. run-time error


Correct Option: D

Find more quizzes: