Throw
keyword is used to re-throw an exception which has been caught in a
catch block. The syntax is “throw e;” where e is the reference to the
exception being caught. The exception is re-thrown to the client.
This
keyword is useful when some part of the exception is to be handled by
the caller of the method in which throw keyword is used.
The use of “throw null;” statement causes NullPointerException to be thrown.
The
answers are brief. Do post your comments if you think I have missed
anything or discuss any other exception handling question.
Posted in: