At IIHT, students are taught in depth about Error and Exception handling in Java. Recovering from an error is not possible. Exception handling in Java is the most powerful mechanism that takes care of runtime errors in order to maintain the normal flow of the application. Exception handling takes care of runtime errors like ClassNotFound, SQL, Remote, IO etc.
This is why Exception is used in order to recover with the use of throwing exception back to caller or try-catch blocks. Errors cannot use try-catch blocks and this is why Exceptions are used. Exceptions have the ability to handle try-catch blocks and make the program flow normal. There are two kinds of exceptions available in Java – unchecked and checked while errors all belong to the same category.
- Checked Exception: Any class that extends Throwable class except Error and RuntimeException are called checked exceptions. These exceptions are checked during compile. Example, SQLException, IOexception etc.
- Unchecked Exception: Any class that extends RuntimeException is called an unchecked exception. These are not checked during compile time but are checked during runtime. Example: NullPointerException, ArithmeticException, ArrayIndexOutOfBoundsException etc.
Get trained in practical application with real life life projects in order to understand the use of these concepts at IIHT’s Java 8 course!