1. Primitive Data Types, Variables & Operators
Java is statically typed --- every variable's type is fixed at declaration, and arithmetic between two int values always produces an int.
Core types int, double, boolean; declaration syntax int x = 5;; arithmetic operators + - * / %; integer division truncates toward zero, so 7 / 2 is 3, not 3.5; 7 % 2 is 1; compound assignment += -= *= /= %=; increment/decrement ++ and --.
/ between two ints (integer division, truncates) vs. / when at least one operand is a double (true decimal division) --- and = (assignment) vs. == (equality test).
Writing int avg = (a + b) / 2; when a and b are ints truncates the true average toward zero; you must cast first, e.g. (double)(a + b) / 2.
int / int $arrow$ int (truncates) $arrow$ cast to double to keep the decimal.