Exit GSSP-JAVA GIAC Secure Software Programmer - Java
Question 4 of 5
0% complete
Q4 Single choice

Wilbert works as a Software Developer for Wintos Inc. He writes the following code.

1. public class tcf
2. {
3. public static void main(String[] args)
4. {
5. try
6. {
7. int x = 5 / 0;
8. System.exit(0);
9. }
10. catch(ArithmeticException e)
11. {
12. System.out.println("Within catch");
13. }
14. finally
15. {
16. System.out.println("Within finally");
17. }
18. }
19. }

What will happen when he tries to compile and execute the code?

  • A

    It will compile and print Within catch as the output.

  • B

    It will compile and execute successfully but will not print anything.

  • C

    It will compile and print Within catch and Within finally as the output.

  • D

    It will compile and print Within finally as the output.