Difference Between Error Handling and Exception Handling

Can anyone describe the difference between Java error handling and exception handling. I do not understand.

Do all errors and exceptions have to be handled by the programmer?

Who is Participating?
marchentConnect With a Mentor Commented:
String []a = new String[10];

here if the value of i get more than 10 or less than 0 then program will crash.

error handling:
if(i < 10 && i >= 0)  System.out.println(a[i]);

exception handling:
catch(Exception e)
{System.out.println("ur array index is invalid");}

NorCal2612Connect With a Mentor Commented:
Exception handling is just one type of error handling (probably the best approach imo :)).

Other ways to indicate errors are just with variables that are set to a specific value if an error occurs during the execution of a program and are checked periodically.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.