Error Handling in JAVA

Error Handling:

The following are keywords used in error handling:

catch : Declares the block of code used to handle an exception.

finally : Block of code, usually following a try-catch statement, which is
executed no matter what program flow occurs when dealing with an exception.

throw : Used to pass an exception up to the method that called this method.

throws : Indicates the method will pass an exception to the method that
called it.

try : Block of code that will be tried, but which may cause an exception.

assert : Evaluates a conditional expression to verify the programmer’s
assumption.

No comments: