Question 89 / 90:  Both the getMessage and toString methods return information about exceptions that are caught.

Which method returns the basic information as well as the class name of the exception?

A  getMessage()
B  toString()
C  getData()
D  toOutput()
<< First < Previous Flashcard Next > Last >>
Explanation:

B. The toString method returns the basic information of an exception being caught as well as the class name—for example, “java.io.FileNotFoundException: … (The filename, directory name, or volume label syntax is incorrect)”.

A, C and D are incorrect.

A is incorrect because the getMessage method returns only the basic information of an exception being caught, not the class name—for example, “… (The filename, directory name, or volume label syntax is incorrect)”.

C is incorrect because there is no getData method.

D is incorrect because there is no toOuput method.

Exam Home Page
https://www.jobilize.com/quiz-my-oca-mock-exam-by-mike-wolf

My OCA Mock

Author:

Access: Public Instant Grading

Ask
Szilárd Jankó
Start Quiz
Stephanie Redfern
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/quiz-my-oca-mock-exam-by-mike-wolf" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>