Solved

Difference Between Error Handling and Exception Handling

Posted on 2006-11-03
2
426 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 80 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 45 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

717 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