//Exception Handling In Try Catch Examplae
class excep{
public static void main(String args[])
{
int p,q;
try
{
p=0;
q=45/p;
System.out.println("A Not Exicute"); //This not run but it above error generated
}
catch(ArithmeticException s)
{
System.out.println("Division By Zero Not Possible");
}
System.out.println("It Will be Exicute After Catch Statement");
}
}
Output:
Division By Zero Not PossibleIt Will be Exicute After Catch Statement
No comments:
Post a Comment