Stage 3
Stage 3: Advanced
✅ Complete. Every part below, including Part 15, has its full lesson (
README.md),examples/,exercises.mdandsolutions/, and every program was compiled and run on JDK 21. This stage has been through its cross-part audit.
Goal: Write correct concurrent code, understand enough JVM internals to reason about performance, use Java 21's modern pattern-matching syntax idiomatically, and move off hand-managed classpaths onto Maven. Prerequisites: Stage 2 complete — comfortable designing your own classes/interfaces, using generics/collections/streams, and writing a JUnit test. Time: about 4–5 weeks at 1–1.5 hours a day (~28–30 hours including the project) · Level: can build a small multi-class application unassisted
Parts in this stage
| Part | Topic | Learning outcomes | You will build | Hours |
|---|---|---|---|---|
| 12 | Concurrency | Start a Thread/Runnable; explain a race condition and fix one with synchronized; submit tasks to an ExecutorService; combine results with CompletableFuture; use a java.util.concurrent collection; start a virtual thread and explain when it helps |
Parallel file/URL downloader | ~7 h |
| 13 | Java internals and performance | Explain stack vs. heap for a running program; describe garbage collection at a conceptual level; explain == vs. equals and the String pool; explain the cost of autoboxing in a loop; use a basic profiling approach to find a slow method |
Find and fix the slow method in a sample program | ~5 h |
| 14 | Modern Java and pattern matching | Model a closed set of types with sealed; write an exhaustive pattern-matching switch; use instanceof pattern matching to replace a cast; summarize what changed Java 17 → 21 |
Route webhook-style events with a pattern-matching switch |
~5 h |
| 15 | Build tools and packaging | Convert a hand-compiled project to a Maven pom.xml; run mvn compile/mvn package; build a runnable JAR with a manifest; explain at a high level what Gradle and JPMS modules are for |
Package your CLI tool as a runnable JAR, then as a Maven project | ~5 h |
| 🏁 | Project: Concurrent market-data fetcher | Combine Parts 12–15 into one working concurrent, packaged app | Fetches several URLs concurrently with virtual threads, ships as a runnable JAR and a Maven build | ~6 h |
How every part is organised
Same layout as Stage 1–2:
part-NN-topic/
├── README.md
├── examples/
├── exercises.md
└── solutions/
Stage 3 checklist
- Parts 12–15 done, with every exercise attempted
- Concurrent market-data fetcher project built, working, and packaged as a runnable JAR
- The same project also builds with
mvn package - You can explain one GC concept and one concurrency hazard in your own words
Next: 🧠 Stage 4: DSA in Java