answersLogoWhite

0

Exception handling should be used in Java in all cases where you as a programmer suspect that your code might throw some exceptions or create errors that might look ugly when a user is using the application. In such cases you use exception handling to catch and handle the exception and exit gracefully.

You use the try - catch block in Java for exception handling.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Does the Java exception mechanisms with try and catch clauses contribute to failure tolerance?

Yes, the purpose of the try-catch construct in Java is to help the system handle failure gracefully. Exception handling allows developers to detect errors easily without writing special code to test return values. Even better, it lets us keep exception-handling code cleanly separated from the exception-generating code. It also lets us use the same exception-handling code to deal with a range of possible exceptions.


Advantages of Exception handling in java?

Exception handling helps us catch or identify abnormal scenarios in our code and handle them appropriately instead of throwing up a random error on the front-end (User Interface) of the application. Exception handling allows developers to detect errors easily without writing special code to test return values. Even better, it lets us keep exception-handling code cleanly separated from the exception-generating code. It also lets us use the same exception-handling code to deal with a range of possible exceptions.


Why you handle exception in java?

Exception handling helps us catch or identify abnormal scenarios in our code and handle them appropriately instead of throwing up a random error on the front-end (User Interface) of the application. Exception handling allows developers to detect errors easily without writing special code to test return values. Even better, it lets us keep exception-handling code cleanly separated from the exception-generating code. It also lets us use the same exception-handling code to deal with a range of possible exceptions


Why use catch keyword in java?

no, because catch is used to handle exceptions which are generated from try block


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


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


Why should throw keyword is used in java?

Use it when you are implementing something that says it throws a certain exception when a certain condition is met.


How exception handling mechanism can be used for debugging a program in java?

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.


What is NoSuchMethodFound Exception in java?

It means that you have tried to use a method which doesn't exist.


What is the use of catch block in java?

the catch block catches the exception from the try block to display a proper message about the exception. Answered by, SOORAJ.M.S


How you use java?

Hi You should read Java API , there is every thing that you need.


Why use throw in java in compare try-catch?

we use throws in our program so that we dont need to write try & catch block & to avoid the exception


What is the current version of JDK?

As of February 2, 2012 the latest public release of the standard edition of Java is Java Standard Edition(SE) 7 update 3.


What is throw exception in java?

The presence of the keywords "throws exception" on a method signature means that, the method may throw an exception whhich it does not handle. It also means that the method that is calling or invoking it has to handle such exceptions. If the calling method does not handle that exception it would have to in turn use the same "throws exception" clause and throw it to its parent method.


What is the use of try in java?

The try keyword is used in Java to handle problematic situations that are commonly known as "Exceptions" The try keyword is used in conjunction with the catch keyword. If any exception is thrown by code inside the try block, they will be caught and handled by the catch block. Ex: try { ... ... } catch (Exception e){ ... }


Can unhandled exceptions be tolerated?

Yes, but they dont always result in acceptable or good behavior. Exception handling allows developers to detect errors easily without writing special code to test return values. Even better, it lets us keep exception-handling code cleanly separated from the exception-generating code. It also lets us use the same exception-handling code to deal with a range of possible exceptions. So, it is always a good idea to handle exceptions rather than leave them unhandled


Should you use java or adobe?

I believe that most people have both.


What version of java should you program in?

the version of java that you program in is not of much importance so to speak. But it is always advisable to use the latest version of java in order to use the full set of features that the latest version supports. The latest version of java is java 6 also called Tiger.


Why you start java program by class?

without class non of the folder can run so the java program should start in class we can use the class without object in java


What is the difference using finally block and without finally block?

use of finally block is optional in java.if u want to clean up ur code (means u want to close any connection)after exception handling then go for finally block.if not then also your code will run fine.so finally block is optional in java.