Why is try-with-resources catch block selectively optional?
It is optional if close() is not able to throw a checked exception. However, if close() can, then a checked exception would need to handled in a normal fashion, either with a catch block, or by throwing from the method that try-with-resources block is in. More details are in JLS 14.2.3 14.20.3.2. Extended try-with-resources A … Read more