Exception
May 22, 2015
Make sure to subscribe to our newsletter and be the first to know the news.
May 22, 2015
Make sure to subscribe to our newsletter and be the first to know the news.
try
{
ANY PIECE OF CODE WHICH IS PRONE TO THROW EXCEPTION GOES HERE
THIS REGION IS ALSO CALLED AS "GUARDED REGION"
}
catch(Exception e)
{
HANDLING CODE GOES HERE
}
try
{
-------
-------
-------
-------
}
catch(Exception e){------}
try
{------
Some DB Code
-----
Some IO Code
-----
}
catch(SQLException e)
{
------
}
catch(IOException e)
{
-----
}
catch(Exception e)
{
-----
}
try
{
-------
-------
------
}
catch(Exception e)
{
--------
}
finally
{
House Keeping Code
}
This can be considered as ducking the exception, as we do nothing to handle the exception , if some exception occurs we are not going to catch it,but just do our house keeping works and finish off.
try
{
------
-------
--------
--------
}
finally
{
-----
}
public void m1() throws Exception
{
------------
-------------
----------------
------
}
Now any exception occurring inside this method would be handled by JVM , but the application is going to be terminated.