class TryWithoutFinally { static class Resource implements AutoCloseable { public void close() throws Exception { } boolean find() { throw new UnsupportedOperationException(); } } void test() throws Exception { boolean found = false; try (Resource r = new Resource()) { found = r.find(); } System.out.println(found); } }