Which method can be used to get the detail message of an exception?

  1. printStackTrace()
  2. getMessage()
  3. toString()
  4. getCause()
Correct answer getMessage()

Explanation

getMessage() returns the detail message string of the Throwable.

Update: Admin added a tag on this question

Topics

By Admin · · 26 views