Exception Methods Flashcards

1
Q

Default constructor of the Exception class with no additional information.

A

Exception()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Constructor that takes a detailed information string about the constructor as an argument.

A

Exception(String)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

Exception(String, Throwable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Constructor that takes the cause of the exception as an argument.

A

Exception(Throwable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Returns the detailed message (passed as a string when the exception was created).

A

String getMessage()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Returns the cause of the exception, if any. Returns null if none.

A

Throwable getCause()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Returns the list of suppressed exceptions (typically caused when using a try-with-resources statement) as an array.

A

Throwable[] getSuppressed()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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.

A

void printStackTrace()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly