Java Throwable getSuppressed() method

The getSuppressed() method of Java Throwable class is used to return an array of all the exceptions that were suppressed to deliver this exception. If no exception were suppressed, an empty array will be returned.

Syntax

Return

An array of exceptions that were suppressed to deliver this exception.

Example 1

Output:

Caught inside Main:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at ThrowableGetSuppressedExample1.main(ThrowableGetSuppressedExample1.java:19)