I wanted to know the difference (if any) between try(statement?){} catch() and try{} catch(), that I saw applied in Spring, and if I'm also correct in .net. I have tried both but have not seen any difference. Is it for performance or just a choice?
example:
try (CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build()) {
log.warn("closeable call");
// some logic
}
catch (exception e) {
e.printStackTrace();
}
try {
// some logic
} catch (exception e) {
e.printStackTrace();
}