Showing posts with label Exception Handling. Show all posts
Showing posts with label Exception Handling. Show all posts

Apr 28, 2016

Catching and Handling Exceptions in Java

In Java, we have 3 exception handlers: try, catch and finally, to catch and handle the exception. Along with these handlers, one more handler try-with-resources has been introduced in Java 7.

Lets see how to use these exception handlers.
Consider the following example which copies a file from source to destination: