?
Solved

Difference Between Error Handling and Exception Handling

Posted on 2006-11-03
2
Medium Priority
?
428 Views
Last Modified: 2010-03-31
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?

0
Comment
Question by:tristatefab
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
marchent earned 240 total points
ID: 17870040
String []a = new String[10];
System.out.println(a[i]);

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:
try
{System.out.println(a[i]);}
catch(Exception e)
{System.out.println("ur array index is invalid");}

~marchent~
0
 
LVL 4

Assisted Solution

by:NorCal2612
NorCal2612 earned 135 total points
ID: 17870854
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.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question