Java InterviewQuestionsโ & real answers.
18+ questions covering Java 21, Spring Boot 3, JVM internals, and distributed systems. Written by engineers who've been on both sides of the whiteboard.
How to use this guide
Each question is collapsible โ click to reveal the full answer. Filter by difficulty to focus your prep. Senior engineers: skip to JVM Internals and Microservices.
What interviewers actually want
They don't just want the definition. They want to know you understand the *why*, can give a concrete example, and know when *not* to use a given approach.
Realistic prep timeline
Junior: focus on the Screening Room + OOP modules (3โ4 hours). Mid-level: add Spring Boot and Core Java (full day). Senior: all modules, especially JVM and Microservices.
Java interviews in 2026 look different than they did five years ago. The JVM has changed. The ecosystem has changed. And the bar for what counts as "senior" has quietly risen.
A decade ago, memorizing the difference between HashMap and ConcurrentHashMap was enough to clear a mid-level screen. Today, interviewers at product companies expect you to reason about virtual threads, GraalVM compilation tradeoffs, and distributed transaction patterns โ not just recite them, but apply them to novel scenarios on the spot.
This guide is built around that reality. Every answer goes deeper than the definition, includes a concrete example or failure mode, and ends with the practical implication โ what you'd actually do differently in a codebase. That's the level interviewers are testing at, and that's what this guide prepares you for.
๐งฑ The Primacy of OOP Principles
Before frameworks and tooling, every Java interview starts here. Interviewers use OOP questions to gauge how you *think*, not just what you've memorized.
๐๏ธ SOLID Principles & Design Patterns
Knowing patterns is table stakes. Knowing *when not to use them* is what separates mid-level candidates from seniors.
โ๏ธ JVM Internals & Memory Management
This is where junior candidates tap out. A solid understanding of GC tuning and memory models signals you're ready for production systems at scale.
๐ Java 21 & Modern Language Features
Java 21 is a landmark LTS release. Knowing the 'what' is easy. Interviewers want to know the 'why' โ the design problems each feature actually solves.
๐ฑ Spring Boot 3 & Cloud Native
Spring Boot 3 assumes you're deploying to Kubernetes or serverless. GraalVM, Micrometer Observability, and virtual thread support change the runtime story fundamentally.
๐ธ๏ธ Microservices & Distributed Systems
The hardest part of microservices isn't the technology โ it's managing failure gracefully. These questions probe for experience with real production incidents.
๐ฏ Recruiter Screening Room
These questions appear in the first 30 minutes of almost every Java interview. They're easy to dismiss and easy to fumble. Nail them cold.
Virtual Threads in practice
The snippet below starts 10,000 concurrent tasks โ each sleeping for a second โ with virtual threads. On traditional platform threads, this would exhaust thread pool limits or consume gigabytes of stack memory. With Loom, it's lightweight enough to run on a laptop.
Modern concurrency with Virtual Threads (Java 21)
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
IntStream.range(0, 10_000).forEach(i -> {
executor.submit(() -> {
// This blocking call releases the carrier thread,
// not the entire OS thread โ that's the Loom magic.
Thread.sleep(Duration.ofSeconds(1));
return i;
});
});
}
// Executor auto-closes here, awaiting all 10,000 tasks.
// Total wall time: ~1 second, not 10,000 seconds.In application.properties: spring.threads.virtual.enabled=true. That's it. Spring Boot 3.2+ handles the rest.
CPU-heavy code (encryption, compression, computation) doesn't benefit. Virtual threads help when you're *waiting*, not *computing*.
Traditional JDBC drivers hold OS threads while waiting on queries. Virtual thread gains require async-compatible drivers or connection pool tuning.
Day-before interview checklist
Quick review items that make the difference in the first 20 minutes.
Can you explain LSP with a concrete Java example (not just the definition)?
Do you know why field injection is discouraged โ not just that it is?
Can you explain what a load barrier is in ZGC's context?
Do you know the difference between platform threads and virtual threads at the OS level?
Have you used sealed classes and pattern matching switch in at least one pet project?
Can you name 2 things that break with GraalVM Native Images?
Can you draw the Saga choreography flow on a whiteboard with compensating steps?
Do you know the difference between a trace, a metric, and a log โ and which tool to reach for?
Good luck โ the best interviews feel like conversations, not interrogations.
Last updated April 2026 ยท Covers Java 21 LTS + Spring Boot 3.3
M. Leachouri
Founder & Chief Architect"I built Kodivio because professional tools shouldn't come at the cost of your privacy. Our mission is to provide enterprise-grade utilities that process data exclusively in your browser."
M. Leachouri is an Expert Web Developer, Data Scientist Engineer, and Systems Architect with a deep specialization in DevOps and Cybersecurity. With over a decade of experience building scalable distributed systems and Zero-Trust architectures, he engineered Kodivio to bridge the gap between high-performance computing and absolute user sovereignty.