Why do i encounter 'arithmeticexception in java'?

Example:

int value = 1/0;
Solution:

This exception is thrown when an exceptional arithmetic condition, such as a division by zero, has occurred. Always handle or check such conditions in your code.


if(denominator != 0) {
    int value = numerator/denominator;
}

Beginner's Guide to Java