Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Exception Handling in Java is a very powerful capability. Exception Handling all

ID: 3547366 • Letter: E

Question

Exception Handling in Java is a very powerful capability. Exception Handling allows us to check input, verify if files exist, precent division by zero, prevent array out of bounds, and a whole host of other things. What are some of the more popular exception handling uses? Visit:http://java.sun.com/docs/books/tutorial/essential/exceptions/ for more information. Provide a problem and how exception handling can be used to solve the problem. You don't need to be overly detailed, just make sure you could use exception handling to solve it.

Explanation / Answer

The Exception Handling Application Block is best used in situations that require uniform and flexible procedures for handling exceptions.

For example, you might want consistent exception handling procedures for all components in a particular tier of an application's architecture. Also, because of changing security or other operational issues, you might want the ability to change policies as needed, without requiring application source code changes. The Exception Handling Application Block, in conjunction with the Enterprise Library Configuration Console, lets you accomplish both tasks.


Consider the Java program below which divides two integers.

}

In this case we are dividing a by zero which is not allowed in mathematics, so a run time error will occur i.e. an exception will occur.

So we have to use exception handling in this case in order to solve the problem like this --


Refernce1 : http://msdn.microsoft.com/en-us/library/ff649052.aspx