Showing posts with label EXCEPTION. Show all posts
Showing posts with label EXCEPTION. Show all posts

Thursday, 23 January 2014

throw EXCEPTIONS IN JAVA

Java:Using throw


When to use throw in a Java method declaration?

All methods use the throw statement to throw an exception. The throw statement requires a single argument: a Throwable object. Throwable object are instances of any subclass of the Throwable classThe flow of execution stops immediately after the throw statement;any subsequent statements are not executed.

Wednesday, 22 January 2014

USING try AND catch

How to use exception handling keywords try and catch in java

THE try BLOCK


A try statement is used to catch exceptions that might be thrown as your program executes. You should use a try statement whenever you use a statement that might throw an exception,That way,your program won’t crash if the exception occurs.The first step in constructing an exception handler is to enclose the code that might throw an exception within a try block.