Jul 26

Explain try with resource statement with example in java

 

The try-with-resources:

Java 7 added a new construct called try-with-resources.

To understand try with resources we need to understand how resources are handled before java7.Before

Java 7, when we worked with a resource, such as a file, a SQL statement, etc., you had to use a finally

block and write a few lines of boilerplate code to close the resource.

Continue reading