☕ Java path
Java 21 interview questions and study guide
8 lessons from beginner to advanced. Each lesson explains the concept, shows a worked example and lists the follow-up questions interviewers ask next.
Start with lesson 1 →Intermediate 1 lesson
Advanced 7 lessons
- Java 21: Run 1,000 blocking I/O tasks concurrently. Compare sequential, thread pools, CompletableFuture and virtual threads.
- Java 21: Evaluate and simplify an expression tree. Compare instanceof chains, polymorphism, the visitor and pattern matching for switch with record patterns.
- Java 21: Model an order lifecycle as a state machine. Compare string states, polymorphic states and pattern matching on (state, event) pairs.
- Java 21: Fan out to several suppliers with a timeout and pick the cheapest quote. Compare CompletableFuture, invokeAll on virtual threads and structured concurrency.
- Java 21: Build a thread-safe request counter under 100,000 virtual threads. Compare unsynchronised, synchronized, ReentrantLock, AtomicLong and LongAdder.
- Java 21: Handle validation errors without exceptions for control flow. Compare exceptions, Optional and a sealed Result type with pattern matching.
- Java 21: Migrate a legacy report method from Java 7 to Java 8, 17 and 21, step by step.