This type of statements are very useful whenever the method containing the try statement throws an exception.
Example:
myMethod throws ArithematicException
{
try{
a=1/0;
} <--- Observe that there is no catch block
finally{
System.out.println("the above try obviously throws exception");
}
}
Example:
myMethod throws ArithematicException
{
try{
a=1/0;
} <--- Observe that there is no catch block
finally{
System.out.println("the above try obviously throws exception");
}
}
No comments :
Post a Comment