Java Interview Questions: The Topics That Come Up
Java interviews focus on OOP, collections, exceptions, equals/hashCode, streams and lambdas, concurrency, and the JVM. Here's the topic map of what actually gets asked, by level, with what to know for each.
Java interviews draw from a predictable set of topics — OOP, the Collections framework, equals/hashCode, exceptions, streams and lambdas, concurrency, and the JVM — layered by level, plus a coding round on data structures and algorithms. Know this map and you’re ready for most Java rounds.
Here’s what gets asked, with where to go deeper. Pair it with the language-agnostic coding interview roadmap for the algorithms side.
Core topics (all levels)
OOP and the four pillars
Encapsulation, inheritance, polymorphism, abstraction — the most-asked area. Know the difference between abstraction and encapsulation, and interface vs abstract class.
The Collections framework
List, Set, Map and their implementations, with Big O. Expect “ArrayList vs LinkedList?” and “HashMap vs TreeMap?“
equals() and hashCode()
The contract and why you override both together — a classic trap question tied to how HashMap works.
Exceptions
Checked vs unchecked, the hierarchy, try-with-resources, and when to use each.
Intermediate topics
Streams and lambdas
Functional Java — lambdas, the stream pipeline, intermediate vs terminal operations, and Optional. Increasingly expected for mid-level roles.
Modern Java
Records, sealed classes, pattern matching, var — interviewers now ask about Java 17–21 features.
Senior and staff topics
Concurrency
Threads, synchronized, the memory model, volatile, thread pools, virtual threads, and race conditions. A defining senior topic.
The JVM and garbage collection
How the JVM runs bytecode, the heap vs stack, and how GC works — including whether Java can still leak memory (it can).
Quick-fire questions to expect
- Four pillars of OOP? Abstraction vs encapsulation?
- ArrayList vs LinkedList? HashMap internals?
- Why override
hashCode()withequals()? - Checked vs unchecked exceptions?
String,StringBuilder,StringBuffer— differences?- How does
synchronizedwork? What’s a race condition? - What is the JVM? How does garbage collection work?
equals/hashCode contract and collection trade-offs are near-certain — make sure those are airtight.
A focused prep checklist
- Explain the four pillars, collections trade-offs, and the equals/hashCode contract clearly.
- Know checked vs unchecked exceptions and try-with-resources.
- For senior roles, explain concurrency hazards and how the JVM/GC work.
- Practise the coding interview roadmap for the DSA round, in Java.
Where this fits
Java interview prep spans the upper phases of the Java roadmap and connects to the general coding interview roadmap.
The core and intermediate topics are worked through in the job-ready Java in Three Months, and the senior/staff material — concurrency, the JVM, performance, system design — is in Java for Staff Engineers.
Know the topic map by level, keep the equals/hashCode and collections answers airtight, and Java interviews become predictable.
Frequently asked questions
What topics come up most in Java interviews?
The recurring topics are OOP and the four pillars, the Collections framework, equals and hashCode, exception handling, streams and lambdas, concurrency and multithreading, and JVM internals including garbage collection. Modern Java features like records and virtual threads increasingly appear too, alongside general data-structure and algorithm coding rounds.
What should a junior Java developer know for interviews?
Juniors should know the four pillars of OOP, primitives vs objects, the core collections (List, Set, Map), exception handling, == vs equals(), and basic coding with arrays and strings. Being able to explain inheritance, polymorphism, and why you override equals() and hashCode() together covers the common ground.
What advanced Java topics are asked in senior interviews?
Senior Java interviews probe concurrency (threads, synchronization, the memory model, virtual threads), JVM internals and garbage collection, performance and memory tuning, design patterns, and system design. They test depth on how the JVM runs and how to write correct concurrent code, not just language syntax.
How do I prepare for a Java coding interview?
Master core Java — OOP, collections, exceptions, streams — so you write clean idiomatic code, then practise data structures and algorithms for the problem-solving round. Be ready to explain collections trade-offs, the equals/hashCode contract, and concurrency basics, which are the most common conceptual questions.