In this example we will show you how to use modulus operator in Java.
Source Code
package com.beginner.examples;
public class ModulusOperator {
public static void main(String[] args) {
int a = 11;
int b = 3;
System.out.println(a % b); // use modulus operator
}
}
Output:
2