Have Just studied this topic and for what I understood is that the
close() method can throw an exception in addition to the try block itself. Also, these exceptions are saved in an suppressed array.
By doing this
test, I got what I expected in the output:
Output:
But when I remove one object declaration of the <try-with-resources> for some reason, the "finally" is printed first and I just can not understand why
I thought the output will be:
Hope you can help me!