Stage 2
Stage 2: Intermediate
✅ Complete. Every part below 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: Design your own classes and interfaces, use the Collections Framework and streams idiomatically, write JUnit tests, and talk to a real HTTP API and a real database. Prerequisites: Stage 1 complete — comfortable with primitives, arrays,
ArrayList/HashMapas a user, methods, and basic try/catch. Time: about 6–7 weeks at 1–1.5 hours a day (~37–39 hours including the project) · Level: has written small Java programs, ready for objects
Parts in this stage
| Part | Topic | Learning outcomes | You will build | Hours |
|---|---|---|---|---|
| 8 | Object-oriented Java | Write classes with constructors and encapsulated fields; use inheritance and super; write and use interfaces (incl. default methods) and abstract classes; override equals/hashCode/toString; choose enum or record where they fit |
Bank account system | ~10 h |
| 9 | Generics, collections and functional Java | Write a generic class/method with a bounded type; implement Comparable, write a Comparator; choose the right List/Set/Map/Deque implementation; write lambdas and use method references; chain Stream operations; use Optional instead of null-checking |
Student gradebook with custom sorting; sales report via streams | ~8 h |
| 10 | Testing and code quality | Set a breakpoint and step through code in an IDE; write JUnit 5 tests with assertions and @BeforeEach; add basic logging; write a Javadoc comment; make a Git commit and push to GitHub |
Test the discount calculator and the bank account | ~5 h |
| 11 | I/O, APIs and databases | Call a REST endpoint with HttpClient and read the JSON response; connect to a database with JDBC using one external driver jar; write parameterized queries safely; use basic regex |
Weather lookup over HTTPS; orders database | ~6 h |
| 🏁 | Project: Library management system | Combine Parts 8–11 into one working OOP + Collections/streams + JUnit + JDBC app | Book/Member/Library classes with SQLite persistence (CLI) |
~8 h |
How every part is organised
Same layout as Stage 1:
part-NN-topic/
├── README.md
├── examples/
├── exercises.md
└── solutions/
Stage 2 checklist
- Parts 8–11 done, with every exercise attempted
- Library management system project built and working, backed by a real SQLite database
- At least one class with a full JUnit test file
- Code pushed to a GitHub repo
Next: 🔴 Stage 3: Advanced (concurrency, JVM internals, modern Java, build tools)