Incremental Java Modulus Operator Modulus Operator If both operands for /, the division operator have type int, then integer division is performedThis is regular division, where the remainder is thrown away What if we needed the remainder?Java has one important arithmetical operator you may not be familiar with, %, also known as the modulus or remainder operator The %operator returns theJRJC How To Use Modulo Modulo is nothing more than "remainder after division" So modulo 5 is 0 because divided by 5 is 4 with no remainder 21 modulo 5 is 1 22 modulo 5 is 2 23 modulo 5 is 3 24 modulo 5 is 4 25 modulo 5 is 0 In C, C and Java, modulo is represented as the percent sign So int a = % 5 ;
Types Of Java Operators Nourish Your Fundamentals Dataflair