% modulo operator yields the remainder from an implied division of the left operand (dividend) by the right operand (divisor).
The result will be negative only if the dividend is negative.
Note that if the operands are integers, the ArithmeticException can be thrown if the divisor is zero.
public class MainClass{
public static void main(String[] argv){
System.out.println(7%2);
}
}
|