Custom AutoClosable in Java

Please go through try-with-resource article on understanding try with resource in java 7 We know that any resource which implements AutoCloseable interface can become a potential candidate for try with resource Try with resource feature can be used even for custom java class All we need to do to achieve this is , implement AutoCloseable […]

Share this article on

Try with resource

Try-with-resources in Java 7 is a new way of exception handling which makes it easier to automatically close resources that are used within a try-catch block. A resource is an object that must be closed after using it. Example : A file resource for file IO operations, JDBC resource for database connection etc. Before this […]

Share this article on
< Previous Next >