Exception Methods in Java

Here is a list of methods that are available as part of the Throwable class.

  • public Throwable getcause()
    This method gives back the cause of the exemption as mentioned by a Throwable item.
  • public String getmessage()
    This method gives back the exception’s complete message and details. This message is usually included in the Throwable constructor.
  • public void printstacktrace()
    This method prints the aftereffect of tostring() alongside the stack follow to System.err, the output stream for error.
  • public String tostring()
    The method gives back where its due of the class linked with the aftereffect of getmessage()
  • public Throwable fillinstacktrace()
    The method fills the stack of this Throwable object with the current trace of stack, adding to any past data in the trace of stack.
  • public Stacktraceelement [] getstacktrace()
    The method gives back a array containing every component on the trace of stack. The component at file 0 speaks to the highest point of the call stack, and the last component in the show speaks to the system at the base of the call stack.

 

For any query or issue, feel free to discuss on http://discuss.eduguru.in