More operators
We can already add (+
), take away (-
), multiply (*
), divide (/
), assign (=
), increment (++
), and decrement (--
) with operators. Let's introduce some more super useful operators, and then we will move straight on to understanding how to use them in Java.
Tip
Don't worry about memorizing every operator shown here. Take a glance at them and their explanations and then quickly move on to the next section. We will put some operators to use soon and they will become much clearer as we look at a few examples of what they allow us to do. They are presented here in a list, just to make the variety and scope of the operators clear from the start. The list will also be more convenient to refer back to when they're not intermingled with the discussion about implementation that follows it.
We use operators to create an expression that is either true or false. We wrap that expression in parentheses like this: (expression goes here)
. Let's take a look at...