The getSuppressed() method of Throwable class used to return an array containing all of the exceptions that were suppressed to deliver this exception typically this suppression done by the try-with-resources statement. In order to deliver Exception If no exceptions were suppressed or suppression is disabled, an empty array of suppressed exception is returned. Any changes to the returned array do not affect future calls to this method.
public final Throwable getSuppressed()
Parameters: This method does not accepts anything as a parameter.
Returns: This method returns return an array containing all of the exceptions that were suppressed.
Below programs illustrate the getSuppressed() method of Throwable class:
Please Login to comment...