arithmetic exception
It occurs when there is an error
in the aritchmatic logic. For
Example we can't divide int to 0.
In this case it will throw arithmatic
exception and we can handle with
try catch block.(unchecked exception)
arithmetic exception
It occurs when there is an error
in the aritchmatic logic. For
Example we can't divide int to 0.
In this case it will throw arithmatic
exception and we can handle with
try catch block.(unchecked exception)
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");
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us