In the last lesson we learned how to use addition in Java. In this lesson, we are going to move on to subtraction, multiplication, and division! Luckily, all the principles that we learned with addition still apply. Only the symbols and results are different. Let us start by looking at subtraction.

Subtraction as you can probably guess is used with the subtraction operator: – .

Look at the example below:

The output from the above equation is: `4`

.

As you can see, it is easily implemented the same way as the addition operator. Let’s now look at the multiplication operator.

The multiplication operator is the asterisk symbol: `*`

. Look at the example below to see how it is used in Java.

The output from the above equation is: `12`

.

Once again, by looking at the example above we can see it is used again in the same manner as the other operators.

Lastly, let us go over the division operator: `/`

. Observe the example below to see the operator in action.

The output from the above equation is: `4`

By now, you can probably see how easily we can use Java to perform simple addition, subtraction, multiplication, and division equations. In the next lesson, we are going to learn how to construct more intricate math problems in Java.

## Leave a Reply