what is difference between Exception and Error?
Answers were Sorted based on User's Feedback
Answer / doshi rinal 9998099633
Error: Any departure from the expected behavior of the
system or program, which stops the working of the system is
an error. Exception:Any error or problem which one can
handle and continue to work normally.
An Exception can be caught and recovered:
ArrayIndexOutOfBoundsException means you tried to access a
position of an Array that does not exist - no big deal.
An Error is unrecoverable: OutOfMemoryError means that
the JVM has no more memory to store.
Java a compile time error is normally called an "error,"
while a runtime erroException can be handled and Error can
not be handled
When Error occur then our program stops and don't run but
If exception occur then nothing happening only try block
will be suspended and after that if any code is written
that will be executed properly means our system or program
work properly.
r is called an "exception."
Is This Answer Correct ? | 13 Yes | 10 No |
Answer / suresh.g
Exception is handled at the run time.
Eg:- divide by zero.
Error is some thing is wrong in program.
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / s.devi
Error will not be controlled by the developer .
Eg:
Stack over flow,Memory over flow,Hard-disk failure,I/O
failure.
Exception will be controlled by the developer.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / mukesh kumar
Exceptions are abnormal condition that occur at run time and
it can be handle through try catch block.
Errors are those abnormal condition that occur at compile
time and can not be handle. Error terminates the program
whereas exception does not terminate program directly, it
provide chance to handle that abnormal condition.
Is This Answer Correct ? | 2 Yes | 0 No |
Error occurs at runtime and cannot be recovered, Outofmemory
is one such example. Exceptions on the other hand are due
conditions which the application encounters such as
FileNotFound exception or IO exceptions
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / kapil gupta
Error is syntax error
where
Exception is logical error
and it can be handle by try-catch block
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / fareed
exception:bad input handled by compiler at runtime
error:comnpiler cant be handled and cannot be managed by
compiler
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kannan
Error is a broader term which could be used to define all
not-so-expected behaviour of the program in
which 'Exception' is of one kind. Like many answered here,
exception is an unexpected behaviour at run time which
could cause the processor to rise the exception and can be
captured/handled in the program and further it could be
thrown to higher level code.
Compiletime error:
The other types of errors could be compile time errors
mainly captured by the compiler based on not-in-agreement
with the specific language specification.
Program logic error (function):
This type of error is left in the program after cleaning
compile time error and may or may not cause an exception.
This means the program could produce a wrond result.
Abnormal Operation error:
This type of error is produced by operating the program in
not so expected way. This means, under normal operating
condition the program will produce right results but could
produce wrong results if the operating procedure is not
followed. This is important aspect to fix in mission
critical applications.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vikas deshmukh
both inherit from Throwable, some differences are,
Exceptions:
1)It can be checked or unchecked
2)It indicate an error caused by the programmer
3)It Should be handled at the application level
Errors:
1)Errors are always unchecked
2)Usually indicate a system error or a problem with a low-level resource
3)It should be handled at the system level, if possible
Is This Answer Correct ? | 1 Yes | 0 No |
What if I write static public void instead of public static void in java?
What are "methods" and "fields"?
What are the major advantages of internal iteration over external iteration?
Implement two stacks using a single array.
What is garbage collector?
what is j2se
What is math in java?
Can a class have multiple superclasses?
Explain importance of finally block in java?
Is string a wrapper class?
What is Co-Variant return type in method overriding?
What will be the output of round(3.7) and ceil(3.7)?