Solved

Difference Between Error Handling and Exception Handling

Posted on 2006-11-03
2
422 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now