Glossary
Assignment Operator (=)
Evaluates the expression on the right side and stores the resulting value into the variable on the left side.
Example:
In int score = 100;, the value 100 is assigned to the variable score.
Decrementing (--)
A shorthand unary operator (`--`) used to decrease the value of a numeric variable by 1.
Example:
If lives is 3, then lives--; makes lives become 2.
Double Division
Division where at least one of the operands is a `double` (or float), resulting in a `double` value that includes the decimal part.
Example:
double average = 7.0 / 2; will store 3.5 in average, preserving the decimal.
Incrementing (++)
A shorthand unary operator (`++`) used to increase the value of a numeric variable by 1.
Example:
If count is 5, then count++; makes count become 6.
Integer Division
Division performed between two integer operands, where the result is always an integer with any fractional part truncated (removed).
Example:
int result = 7 / 2; will store 3 in result, not 3.5, because the decimal is truncated.
Modulo Operator (%)
An arithmetic operator (`%`) that calculates and returns the remainder of an integer division.
Example:
int remainder = 10 % 3; will store 1 in remainder because 10 divided by 3 is 3 with a remainder of 1.
Order of Operations (PEMDAS/BODMAS)
The set of rules that dictates the sequence in which mathematical operations are performed in an expression (Parentheses, Exponents, Multiplication/Division/Modulo, Addition/Subtraction).
Example:
In 2 + 3 * 4, multiplication is done first, so the result is 14, not 20, following the order of operations.
double (data type)
A primitive data type in Java used to store floating-point numbers, which can have decimal parts, providing higher precision than `float`.
Example:
double price = 19.99; declares a double variable price to store a value with decimals.
int (data type)
A primitive data type in Java used to store whole numbers (integers) without any fractional or decimal part.
Example:
int age = 17; declares an integer variable age and initializes it to 17.