Using finally statement
Java supports finally statement that can be used to handled an exception that not caught any of the previous catch statement finally block can be used to handled generated within a try block when a finally block is define this is grunted to executed, regretless of whether or not an exception in through. The block will illustrate in bellow : --
Try
{
---------------------------------
---------------------------------
}
Try
{
----------------------------------
----------------------------------
}
Catch(Exception e)
{
-----------------------------------
-----------------------------------
}
Catch(Exception e1)
{
------------------------------------
------------------------------------
}
-------------------------------------
-------------------------------------
finally
{
-----------------------------------------
--------------------------------------------
}
finally
{
----------------------------------------
----------------------------------------
}
No comments :
Post a Comment