Stage 1
Stage 1: Foundation
✅ Complete. Every part below has its full lesson (
README.md),examples/,exercises.mdandsolutions/, and every program was compiled and run on JDK 21. The stage-wide cross-part audit (seams, naming/currency normalization) is done.
Goal: Write small, real Java programs on your own — calculators, menus, a shopping cart, file-based tools — using primitives, arrays, ready-made collections, methods and basic exceptions, all inside
staticmethods. No classes of your own yet; that starts Stage 2. Prerequisites: none. A computer that can install the JDK 21 (see../TOOLING.md) and a text editor or IDE. Time: about 6 weeks at 1–1.5 hours a day (~41–43 hours including the project) · Level: absolute beginner, no coding experience needed
Parts in this stage
Do them in order. Each part builds on the ones before it.
| Part | Topic | Learning outcomes | You will build | Hours |
|---|---|---|---|---|
| 1 | How Java runs | Install JDK 21 LTS and an editor/IDE; explain JDK vs. JRE vs. JVM; compile with javac and run with java; describe source → bytecode → JVM; read a classpath error |
Compile and run your first Hello.java + a welcome banner |
~3 h |
| 2 | Language fundamentals | Declare typed variables; pick the right primitive type; use String methods; cast between numeric types safely; read input with Scanner; use var and text blocks correctly |
Restaurant bill splitter | ~6 h |
| 3 | Control flow | Write if/else and nested conditionals; choose classic switch vs. arrow switch expressions; write while/for/for-each loops; use break/continue correctly |
ATM menu with 3 PIN attempts | ~5 h |
| 4 | Arrays and collections basics | Declare and iterate arrays (1D and 2D); use ArrayList, HashMap, HashSet as ready-made tools; explain autoboxing at a usage level; pick array vs. ArrayList for a given task |
Shopping cart | ~6 h |
| 5 | Methods | Write static methods with parameters/return types; overload methods; use varargs; explain scope; write a simple recursive method |
Discount calculator | ~5 h |
| 6 | Exceptions basics | Write try/catch/finally; distinguish checked vs. unchecked exceptions; throw and catch a custom exception; read a stack trace | Safe PIN/amount input for an ATM | ~4 h |
| 7 | Packages, I/O and build basics | Organize files into packages matching folder structure; compile a multi-file program; read/write text files with java.nio.file and try-with-resources |
To-do list saved to a text file; simple log parser | ~5 h |
| 🏁 | Project: Expense tracker | Combine Parts 2–7 into one working CLI program | A complete command-line app | ~7 h |
How every part is organised
part-NN-topic/
├── README.md ← 1. read the lesson
├── examples/ ← 2. run the example programs
├── exercises.md ← 3. solve the practice questions yourself
└── solutions/ ← 4. only then compare with the solution
How the code runs
From the repo folder:
javac stage-1-foundation/part-02-language-fundamentals/examples/08_bill_splitter.java -d /tmp/out
java -cp /tmp/out BillSplitter
Everything in Stage 1 uses only the JDK (see ../TOOLING.md) — nothing else to install.
Stage 1 checklist
- Parts 1–7 done, with every exercise attempted
- Expense tracker project built and working
- (Optional) Saved your practice code on GitHub (Git is covered in Stage 2, Part 10)
- (Optional) Looked at Oracle's OCA practice questions (paid certificate, not required)
Next: 🟡 Stage 2: Intermediate (OOP, generics, collections in depth, streams, testing, JDBC)