Subtraction

You can subtract any two ints using the - operator.

int x = 5;
// y will be 4
int y = x - 1;
// z will be 1
int z = x - y;

System.out.println(x);
System.out.println(y);
System.out.println(z);

Subtracting a negative number does the same thing as addition.

int x = 5;
// y will be 9
int y = x - -4;

System.out.println(x);
System.out.println(y);