The modulus operator (%) in Java returns the remainder of the division of two numbers. In this case, 10 % 3 equals 1.
public class ModulusExample {
public static void main(String[] args) {
// Define the numbers
int a = 10;
int b = 3;
// Calculate the result using the modulus operator
int result = a % b;
// Display the result
System.out.println("Result of " + a + " % " + b + " is: " + result);
}
}
When you run this program, it will output:
Result of 10 % 3 is: 1