Exception Methods Flashcards
Default constructor of the Exception class with no additional information.
Exception()
Constructor that takes a detailed information string about the constructor as an argument.
Exception(String)
In addition to a detailed information string as an argument, this exception constructor takes the cause of the exception (which is another exception) as an argument.
Exception(String, Throwable)
Constructor that takes the cause of the exception as an argument.
Exception(Throwable)
Returns the detailed message (passed as a string when the exception was created).
String getMessage()
Returns the cause of the exception, if any. Returns null if none.
Throwable getCause()
Returns the list of suppressed exceptions (typically caused when using a try-with-resources statement) as an array.
Throwable[] getSuppressed()
Prints the stack trace(i.e, the list of method calls with relevant line numbers) to the console. If the cause of an exception is available, that information will also be printed. Further, if there are any suppressed exceptions, they are also printed.
void printStackTrace()