What is the value of: `12 - 4/2 + 2`

### Answer:

12, since the expression means: `12 - 2 + 2`

# Arithmetic Operators

An arithmetic operator is a symbol that asks for two numbers to be combined by arithmetic. As the previous question illustrates, if several operators are used in an expression, the operations are done in a specific order.

Operators of higher precedence are done first. The table shows the precedence of some Java operators.

Some operators have equal precedence. For example, addition `+` and subtraction `-` have the same precedence.

The unary minus and unary plus operators are used as part of a negative or a positive number. For example, `-23` means negative twenty-three and `+23` means positive twenty-three. More on this later.

When both operands (the numbers) are integers, these operators do integer arithmetic. If one operand or both operands are floating point, then these operators do floating point arithmetic. This is especially important to remember with division, because the result of integer division is an integer.

For example:

`5/2` is `2` (not `2.5`)
`5/10` is `0` (not `0.5`).

However,

`5.0/2.0` is `2.5`
`5/10` is `0.5` .

More on this later.

OperatorMeaningprecedence
- unary minushighest
+ unary plushighest
* multiplicationmiddle
/ division middle
% remainder middle
+ addition low
- subtractionlow

### QUESTION 22:

What is the value of the following expressions? In each expression, do the highest precedence operator first.

 Expression Value 16 - 12 / 4 2 + 6 / 2 8 + 4*2 8+4 * 2 12/2 - 3 6/8 + 2