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.
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.
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.
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
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
no, because catch is used to handle exceptions which are generated from try block
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
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.
Use it when you are implementing something that says it throws a certain exception when a certain condition is met.
It means that you have tried to use a method which doesn't exist.
the catch block catches the exception from the try block to display a proper message about the exception. Answered by, SOORAJ.M.S
Hi You should read Java API , there is every thing that you need.
As of February 2, 2012 the latest public release of the standard edition of Java is Java Standard Edition(SE) 7 update 3.