Multiple catch with java 7

Java 7 has introduced a new way of writing multiple catch blocks when we want to perform similar task in each catch block. Consider below code snippet try {       execute(); //exception might be thrown   } catch (IOException ex) {       LOGGER.error(ex);   } catch (SQLException ex) {     […]

Share this article on

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
< Previous