Java OCA OCP Practice Question 2046

Question

To Check a call to a print() method of the PrintWriter class was successful or not?.

Select the one correct answer.

  • (a) Check if the return value from the call is -1.
  • (b) Check if the return value from the call is null.
  • (c) Catch the IOException that is thrown when an I/O error occurs.
  • (d) Call the checkError() method of the PrintWriter class immediately after the print() method call returns to see if an IOException was thrown.


(d)

Note

The print() methods do not throw an IOException.




PreviousNext

Related