Java / Exception
What happens when the AutoCloseable resource is null in Java Try-With-Resource?
A resource is closed only if it is initialized to a non-null value. If the reference is null, no attempt is made to call close() on it, no NullPointerException is thrown, and it works as expected.
More Related questions...