Tuesday 25 February 2014

Difference between Error Vs Exception

1. Error are abnormal situations where program can't handle those, where as Exception is also a abnormal situation, but program handle the exception.

2. Error, RuntimeExceptions and its subclasses comes under uncheckedexceptions category, where as Exception and its sub classes comes under checked exceptions category.

3. Almost in all the cases, program is not recoverable from an error,
Ex: OutOfMemoryError, StackOverflowError. But you can catch the exception and recover from that.

4. Both error and RuntimeException comes under unchecked exceptions category, program can handle RuntimeException, where as it can't handle error


Exception Hierarchy                                                 Throwable class                                                 Home

No comments:

Post a Comment