Try-with-resources and return statements in java

Based on Oracle’s tutorial, “[the resource] will be closed regardless of whether the try statement completes normally or abruptly”. It defines abruptly as from an exception.

Returning inside the try is an example of abrupt completion, as defined by JLS 14.1.

Leave a Comment