Answers for "arithmetic exception in java example"

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 "arithmetic exception in java example"

Browse Popular Code Answers by Language