The subtraction operator (-) in Java is used to subtract the right operand from the left operand. In this case, 15 - 7 equals 8.
public class SubtractionExample {
public static void main(String[] args) {
// Define the values of a and b
int a = 15;
int b = 7;
// Use the subtraction operator to calculate a - b
int result = a - b;
// Display the result
System.out.println("Result of a - b: " + result);
}
}
When you run this program, it will output:
Result of a - b: 8