Sr.Java Web Developer Question:

Download Job Interview Questions and Answers PDF

Explain me what are the important methods of Java Exception Class?

Sr.Java Web Developer Interview Question
Sr.Java Web Developer Interview Question

Answer:

Methods are defined in the base class Throwable. Some of the important methods of Java exception class are stated below.

☛ String getMessage() – This method returns the message String about the exception . The message can be provided through its constructor.
☛ public StackTraceElement[] getStackTrace() – This method returns an array containing each element on the stack trace. The element at index 0 represents the top of the call stack whereas the last element in the array represents the method at the bottom of the call stack.
☛ Synchronized Throwable getCause() – This method returns the cause of the exception or null id as represented by a Throwable object.
☛ String toString() – This method returns the information in String format. The returned String contains the name of Throwable class and localized message.
☛ void printStackTrace() – This method prints the stack trace information to the standard error stream.

Download Sr.Java Web Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Please explain what is exception hierarchy in java?Explain me what are the common browser issues you will keep in mind while creating a web application?