Error can also mean java.lang.Error or a subclass, which is an indication that something has gone horribly wrong - you're out of memory, you have infinite recursion, you're missing a required class or library, etc.
Another swing at it... You can extend and throw and catch any Throwable. It's
just that the compiler is more relaxed about Throwble.Exception.Runtime and
Throwable.Error; just those two. Everything else that Is-A Throwable is checked.
i think exceptions are the conditions that arise when something goes wrong or opposing to the rules and guidelines defined for java programs ...
as if you say
IOException ... there must be a file if you are trying to open it.
SQLException ... the SQL engine must be setup and running.
and error unlike an exception is something ... which might or might not let your program to compile ...
as if you say
syntax error ... the code syntax is not according to the java libraries and classes
logical error ... well this is something which will only do something else rather that doing what it intends to do.
Not exactly. Error and its subclasses are intended to flag runtime conditions
that are beyond the programmer's control; a hardware fault, for example.
You should extend and use Error for these unrecoverable, program crashing
problems. The compiler does not check these.
Throwable.Exception.Runtime exceptions can often be pogrammer controlled
but do not arise until the program runs; NullPointerException for example.
Though it would be helpful, the compiler does not check these either. It can't
because they appear only at runtime.
Runtime exception are those condition which occurs when the program is running and some thing goes wrong e.g. ArrayOutOfBoundException when its elements exceede Array size. So this exceptions can be handled through Exception Handling.
Error is a condition which cannot be handled by our program and it is also not handled by java run time environment e.g Stack overflow.
Tell me how it all turns out. Here is a tiny ad:
a bit of art, as a gift, the permaculture playing cards