An enum (enumeration) is a special data type representing a fixed set of constants. Enums are type-safe, readable, and reduce bugs compared to integer constants. Enum constructors are always private. Enums can have variables, constructors, and methods, and work perfectly with switch statements. Decision Making (Control Flow) Control flow allows programs to execute different code blocks based on conditions. Java provides: if (run code if condition is true), if-else (two branches), if-else if-else (multiple conditions — checks top to bottom, stops at first true), and switch (compare one variable against multiple values — cleaner than long if-else chains). Loop Statements Loops repeat code blocks: for (known iteration count), while (unknown iterations), do-while (runs at least once)…
Key Takeaways
Enums are type-safe constants with optional fields and methods.
if-else if checks conditions top to bottom, stops at first true.
switch is cleaner than long if-else chains for value comparison.
Four loop types: for, while, do-while, enhanced for-each.
break stops loop; continue skips current iteration.