No. A RuntimeException and an Error are very different. A RuntimeException is caused by an error (usually incorrect code) occurring entirely inside the runtime environment. An Error may occur outwith the runtime environment, eg running out of memory.
Read the API documentation for Error and RuntimeException and a few of their subclasses. It also means that catch (Exception ex) will allow Errors to propagate.
You should not normally use catch (Error er), but if you ever do, remember to propagate instances of ThreadDeath.
Joined: Jun 03, 2009
Thanks for the reply Campbell Ritchie .
Could you please explain :
Campbell Ritchie wrote:You should not normally use catch (Error er), but if you ever do, remember to propagate instances of ThreadDeath.