Apply all Java foundations in a single cohesive project: a command-line inventory management system using OOP, generics, collections, streams, file I/O, exception handling, and concurrency.
Background
The capstone synthesizes every concept from Labs 1–14: records and sealed interfaces for domain modeling, generics for the repository layer, streams for reporting, NIO.2 for persistence, custom exceptions for validation, CompletableFuture for async operations, and a clean CLI for user interaction. This is the kind of project you'd put in a portfolio.
Time
60 minutes
Prerequisites
Labs 01–14 (all Java Foundations labs)
Tools
Java 21 (Eclipse Temurin)
Docker image: innozverse-java:latest
Lab Instructions
Step 1: Domain Model — Records & Sealed Interface
💡 Sealed interfaces as ADTs enumerate all variants at compile time. The pattern-matching switch compiler checks exhaustiveness — if you add ConsumableProduct to the permits list, every switch must handle it or fail to compile. This is safer than inheritance hierarchies where subclasses can appear anywhere.
Step 2: Custom Exceptions
Step 3: Generic Repository with Validation
💡 This capstone demonstrates the full Java stack in 200 lines: sealed interfaces for type-safe variants, records for immutable domain objects, generics for a reusable repository, streams for every report, NIO.2 for persistence, CompletableFuture for non-blocking I/O, and pattern matching throughout. This is how modern Java applications are written.
📸 Verified Output:
Step 4: Run & Verify
Expected CSV:
Verification Checklist
Feature
Lab Source
Status
Records & sealed interfaces
Lab 06, 07
✅
Custom exceptions
Lab 10
✅
Generic repository
Lab 12
✅
Stream-based reports
Lab 13
✅
NIO.2 file persistence
Lab 11
✅
CompletableFuture async
Lab 14
✅
Pattern matching switch
Lab 05, 07
✅
Collections (Map, List, Set)
Lab 09
✅
Formatted output
Lab 05
✅
🎉 Java Foundations Complete!
You've finished all 15 Java Foundations labs:
Labs 1–3: Hello World, Variables, Strings
Labs 4–5: Arrays, Control Flow & Recursion
Labs 6–8: OOP, Inheritance, Interfaces
Labs 9–11: Collections, Exceptions, File I/O
Labs 12–14: Generics, Streams, Concurrency
Lab 15: Capstone — Inventory System
Next:Java Practitioner — Spring Boot, REST APIs, JPA, testing with JUnit 5.