difference b/w Exception and Error
Printable View
difference b/w Exception and Error
an exception is caught and recovered where as an error is unrecovered
Exceptions are usually the things when something is wrong with the code.
Error is sth which is out of your control , and jvm usually crashes in case of Error so you can't continue the program .
error is something wrong in your code and
exception is wrong part of your code which is already identified
and you want to bypass that error by showing some message when that error occurs
you can make any error as exception by handling it properly...
you can either rewrite a code when an error occurs
or u can make it as an exception and pass some message when it occurs!!!
Exceptions are handled by user code while errors are handled by operating systems variable.
Exceptions are handled by JVM(i.e JVM know the Exception) but Error can not be handled by JVM. We can't do anything if any Error occure in our code.
THANKS®ARDS
KRIPAL
Exceptions are handled by JVM(i.e JVM know the Exception) but Error can not be handled by JVM. We can't do anything if any Error occure in our code.
THANKS®ARDS
KRIPAL
eror occuers when syntax is worng.
exception comes when program logic is wrong.
hai
Error and exception are both mistake there is some little diffrenence .
Error occured in complication time. exception occured in running time
exception:
- it can be handled by jvm.
- it wil be occured in run time.
error:
- it can be handled by us.(missing semicolon at the end of statement, that is handled by us)
- it will be occured at compile time
Errors are the external interrupts that terminate the execution of programme
ex Running out of memory,Stack overflow
Exceptions are abnormal, unexpected events or extraordinary
conditions that may occur at runtime.
Example: file not found exception, unable to get connection exception..etc..