Fail-safe resource close with primary exception
Java
Hard
4 views
Problem Description
Task: simulate primary exception and also close exception; ensure primary is thrown.
Output Format
Return value
Constraints
Add suppressed exception.
Official Solution
static int addSuppressed(Exception primary,Exception closeEx){primary.addSuppressed(closeEx);throw new RuntimeException(primary);}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!