Percent sign in Java calculates the remainder of division, meaning that
7 % 4 = 3
.Another name for this operator is the modulus operator:
System.out.println(9 % 2); // 1
7 % 4 = 3
.Another name for this operator is the modulus operator:
System.out.println(9 % 2); // 1