Monday, September 26, 2016

Exception Handling Examplae Using Try And Catch in Java Programming

//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 Possible
It Will be Exicute After Catch Statement



   

No comments:

Post a Comment