Java Program to explain the concept of throw clause
Program
class throwClause
{
public static void main(String args[]) throws Exception
{
int no=24,i,quot;
for(i=0;i<=5;i++)
{
try
{
quot=no/(i-2);
System.out.println("Quotient:"+quot);
}
catch(ArithmeticException e)
{
System.out.println("Exception Occure at i:"+i);
}
}
}
}
No comments:
Post a Comment