All about Operators
Four different mathematical expressions are used in the Elvis program—to add weight to Elvis, subtract weight from Elvis, divide Elvis, and finish off with some multiplied Elvii. Each of these expressions uses symbols (+, -, *, /, and %) called operators. You will be using these operators to crunch numbers throughout your Java programs.
An addition expression in Java uses the + sign, as in Line 7 of your program:
weight = weight + 10;
This line sets the weight variable equal to its current value plus 10. Because the weight was set to 250 when it was created, Line 7 changes weight to 260.
A subtraction expression uses the - sign, as in Line 10:
weight = weight - 15;
This expression sets the weight variable equal to its ...