Try-with-resources style (concept)
Java
Medium
3 views
Problem Description
Task: show a method that closes a Closeable safely in finally without hiding original exception.
Output Format
In-place update
Constraints
Focus on correct flow.
Official Solution
static void closeQuietly(java.io.Closeable c){if(c==null) return;try{c.close();}catch(java.io.IOException e){throw new RuntimeException(e);}}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!