Problem sets
Exercises
Reading is not enough. Every chapter ends with a small set of problems chosen to make the ideas concrete. Try them in your editor, not in your head.
Foundations
3 problems- ★FizzBuzzPrint 1–100; replace multiples of 3 with Fizz, 5 with Buzz, both with FizzBuzz.
- ★Temperature converterRead a Celsius value from args and print Fahrenheit and Kelvin.
- ★★Prime sieveImplement the Sieve of Eratosthenes up to a user-supplied limit.
Object-Oriented Java
2 problems- ★★Geometry hierarchyModel Shape, Circle, Rectangle, and Triangle with polymorphic area/perimeter.
- ★★Library catalogueBook, Author, Loan — model the relationships and write a checkout method.
Collections & Generics
2 problems- ★★Word frequencyCount words in a text file using a HashMap<String, Integer>.
- ★★Generic Pair<A,B>Implement an immutable Pair with proper equals/hashCode and a static factory.
Modern Java
1 problems- ★★★Stream pipelineGiven a List<Order>, compute revenue per customer using streams only.
Concurrency
1 problems- ★★★Virtual-thread crawlerFetch a list of URLs in parallel using Thread.startVirtualThread and an ExecutorService.