Compiler Error J0120

Divide or mod by zero

The compiler detected a division by zero error.

The following example illustrates this error:

public class Simple {
   
   final int x = 0;
   int y = 1 % x;
   //error: x cannot be 0 
   
}