answersLogoWhite

0


Best Answer

Trapping and handling of runtime errors is one of the most crucial taska ahead of any programmer. AS A DEVELOPER, YOU SOMETIMES SEEM TO SPEND MORE TIME CHECKING FOR ERRORS AND HANDLING THEM THEN YOU DO ON THE CORE LOGIC OF THE ACTUAL PROGRAM.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

yes you can use Exception for tracing bugs and point in code where problem is , before I know formal debugging via Eclipse I used to do this, I just throw Exception from code catch it and print stack trace this way I ensure that my control is reaching till which point in my code and where is actual problem.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

In java by exception handling mechanism your program doesn't terminate on exception. For example for example you can know the value of your desired variable when your program was trying to execute x/(x-y), and caught divide by zero exception.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How exception handling mechanism can be used for debugging a program in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why you uses exception handling because you can handle exception using if Else statement?

We use exception handling so that the program can gracefully handle any situation that may be unexpected. We use try-catch for exception handling. if-else is a conditional logic checking mechanism


Can exception handling resolve the abnormal flow of a program?

An exception is abnormal program flow, so handling the exception is the very definition of resolving the abnormality.


What is the exact difference between interrupt handling and exception handling?

interrupt handling is the process of handling a break or interrupt called by a program where as exception handling is for handling some exceptional conditions that'll occur when a program is running


Why would you want to use user defined exception handling?

sometimes there are situations where the program is vary long which can make error debugging a long process so java provides a facility to make user defined exception handling suppose we are dividing two numbers a/b and if the user enters the value of b 0, the user wants to display an error of your own so the user can do this by using exception handling


When is exception handling necessary for stream handling?

Exception handling is necessary for string handling as there might be some unexpected situation during string handling which may lead to program crash or abrupt termination


What is catch net?

When an exception occurs in program execution. Such as 1/0 or divide by zero exception. The program must catch the exception or the program will crash. Although handling of the exception or solution is not necessary.


Why do you need exception handling codes in a program?

separating error handling code from 'regular' code


What is program debugging?

Debugging a program is to correct, remove a fault, produce better security, etc, in a computer program.


What is the function of structured exception handling or SEH in Windows?

Microsoft supports Structured Exception Handling (SEH) as a programming technique only at the compiler level. In particular, MS Visual C++ compiles __try, __except, and __finally as the three non-standard keywords used in this program. As well, SEH is supported by a number of WIn32 API functions including RaiseException which allows to raise any SEH exceptions manually. Overall, it is a native handling mechanism for Windows and features the "finally" mechanism that is currently not present in the standards C++ exception. SEH is set up to handle each thread of execution separately.


Difference between debugging and maintaining program?

Debugging makes the program works fast while maintainance makes the program slow


What is correcting errors in program called?

Debugging


A program to explain the Exception Handling mechanisms in Java using the keywords try catch and finally?

Here is a code snippet illustrating exception handling: try { int a= 3 / 0 ; } catch ( ArithmeticException e ) { System.out.println ("An ArithmeticException has occured"); } finally { // some code }