Java EE 7 Application Developer — Question 10

Which code snippet prints the exception error message as part of the page output?

Answer options

Correct answer: D

Explanation

The correct answer is D because it uses System.out.println to directly output the exception message to the console, which can be captured in the page output. Options A and B do not properly display the message in the output context, while C merely retrieves the message without displaying it.