Untitled Document

Subscribe here to get updates on new Videos


18. Difference between Exception and Error ?




previous homenext



1. Throwable acts as root for java exception hierarchy

2. Most of the cases Exceptions are caused by our program and this are recoverable .


For Example If our program requirement is to read data from a remote file locating at London at runtime if the London file is not available then we will get FileNotFoundException.

If FileNotFoundException occurs then we can provide a local file and rest of the program will be continued normally.


Read data from a remote file location at London
catch( FileNotFoundException e)
use local file & continue rest of the program normally


1. Most of the times errors are not caused by our program these are due to lack of system resources.

2. errors are non recoverable.


For Example if OutOfMemeory error occurs being a programmer we can’t do anything and the program will be terminated abnormally .

System admin or server admin is responsible to increase heap memory.