Difference 1 –
Error
type exception are thrown due to the problem occurred inside JVM logic like –
- If there is no memory in JSA to create new stack frame to execute method, JVM process is killed by throwing error type exception “java.lang.StackOverflowError”.
- If there is no memory HA to create new object, then JVM process is killed by throwing error type exception “java.lang.OutOfMemoryError”.
Exception
type exceptions are thrown due to the problem that occurred in java program logic
like –
· If we divide an integer number with zero, then
jvm terminates program execution by throwing exception like “java.lang.ArithmeticException”.
Difference 2 –
·
We cannot catch Error type exception, because
Error type exception is not thrown in our application, and once error type
exception is thrown JVM is terminated.
· We can catch Exception type exceptions, because
exception type exception is thrown in our application, and more over JVM is not
directly terminated because of Exception type exception, JVM is terminated only
if the thrown exception is not caught.
No comments:
Post a Comment