+ 1

What is main difference between runtime exception and runtime error in java?

I have read on websites that error cannot be recovered by any handling technique and it have only one type that is unchecked exception if error has exception than it can be handled as well so why it is written that error cannot be recovered by handling technique?

4th May 2020, 8:47 AM
Subhan Ahmed
Subhan Ahmed - avatar
1 Antwort
+ 2
Error and Exception both implement the throwable interface. If you can catch exceptions then certainly you can catch errors as well. Now see, catching errors is not considered a good practice because it is very difficult to know what type of error is going to occur. But you can generally predict a type of exception that is going to occur. https://javarevisited.blogspot.com/2014/02/why-catching-throwable-or-error-is-bad.html https://stackoverflow.com/questions/10956896/can-an-error-be-handled-in-the-same-way-as-an-exception
4th May 2020, 9:17 AM
Avinesh
Avinesh - avatar