Answers for "different types of arithmetic exception in java"

1

arithmetic exception in java

class Example1
{
   public static void main(String args[])
   {
      try{
         int num1=30, num2=0;
         int output=num1/num2;
         System.out.println ("Result: "+output);
      }
      catch(ArithmeticException e){
         System.out.println ("You Shouldn't divide a number by zero");
      }
   }
}
Posted by: Guest on October-15-2020

Code answers related to "different types of arithmetic exception in java"

Browse Popular Code Answers by Language