In the previous lesson you learnt about casting.
Arithmetic operations on primitives
Enter your text here ...
The arithmetic operators are:
- + for addition: e.g., a + b
- - for subtraction: e.g., a - b
- * for multiplication: e.g., a * b
- / for division: e.g., a / b
- % for modulus (i.e., the remainder after division) : e.g., a % b
- ++ for increment by 1: e.g., a++ or ++a
- -- for decrement by 1: e.g., a-- or --a
Take careful note of how the following calculations are performed:
In the next section of lessons you will learn about arrays, loops, and sorts.