Top 100 Java Interview Questions for 2026
A curated list of core Java, OOP, collections, concurrency, and JVM questions asked in product and service company interviews.
Share
Why Java still dominates interviews
Java remains one of the most tested languages in enterprise and product company loops. Interviewers focus on fundamentals, not trivia — expect depth on OOP, collections, concurrency, and JVM internals.
Use this guide as a revision checklist. For each question, practice a 60–90 second spoken answer with a concrete example from a project or assignment.
Core Java and OOP
Start here — these appear in almost every Java screen:
- Explain the four pillars of OOP with Java examples.
- Difference between abstract class and interface (Java 8+ default methods).
- Overloading vs overriding — rules and return type covariance.
- What is the difference between == and equals()?
- Why must equals() and hashCode() stay consistent?
- Explain immutability. How do you create an immutable class?
- Shallow copy vs deep copy.
- Static vs instance variables and methods.
- Final, finally, and finalize — clarify each.
- Can you override a private or static method?
Collections framework
Know when to use each structure and how they behave under the hood:
- ArrayList vs LinkedList — time complexity trade-offs.
- HashMap internal working: buckets, load factor, resizing.
- How does HashMap handle collisions?
- HashMap vs LinkedHashMap vs TreeMap.
- HashSet vs LinkedHashSet vs TreeSet.
- Fail-fast vs fail-safe iterators.
- ConcurrentHashMap vs synchronized HashMap.
- Comparable vs Comparator.
- When would you pick Queue or Deque over List?
- What is the difference between Collection and Collections?
Multithreading and concurrency
Backend and platform roles expect clear answers here:
- Process vs thread.
- Ways to create a thread in Java.
- synchronized keyword vs ReentrantLock.
- What does volatile guarantee?
- Explain the happens-before relationship.
- Thread lifecycle states.
- ExecutorService and thread pool sizing basics.
- Callable vs Runnable.
- CountDownLatch, CyclicBarrier, and Semaphore use cases.
- What is deadlock? How do you prevent it?
JVM, memory, and exceptions
You do not need to be a JVM engineer, but fundamentals matter:
- JVM, JRE, and JDK — how they relate.
- Stack vs heap memory.
- Garbage collection overview (mark-and-sweep, generational GC).
- Checked vs unchecked exceptions.
- try-with-resources and AutoCloseable.
- Custom exception design best practices.
- ClassLoader hierarchy at a high level.
- What causes OutOfMemoryError?
- String pool and interning.
- Why is String immutable in Java?
Java 8+ and modern APIs
Product companies increasingly ask about practical modern Java:
- Lambda expressions and functional interfaces.
- Stream API: map, filter, reduce, collect.
- Optional — when it helps and when it does not.
- Method references vs lambdas.
- Default and static methods in interfaces.
- CompletableFuture basics.
- Records vs traditional data classes.
- Sealed classes and pattern matching (recent LTS versions).
- var and type inference limits.
- Module system (JPMS) — one-line overview.
Generics and type system
Generics separate senior candidates from juniors — know the rules, not just the syntax:
- What is type erasure and what are its implications?
- Difference between extends T> and super T>.
- Why can't you create new T() inside a generic class?
- Can you overload methods that differ only by generic type?
- What is a bounded wildcard? Give a real API design example.
- Raw types — why are they still in the language and why avoid them?
- Generic arrays — why is new List
[10] illegal? - PECS principle (Producer Extends, Consumer Super) explained.
- How do generics work with inheritance (List
- Comparable
vs Comparator in generic collections.
Exception handling and I/O
Backend roles expect confident answers on error handling and file/network I/O:
- Difference between Error and Exception.
- When should you catch Exception vs let it propagate?
- Custom checked vs unchecked exceptions — design guidelines.
- try-with-resources — how does it compile under the hood?
- Difference between InputStream and Reader.
- NIO.2 Path API vs legacy File class.
- Serializable interface — what gets serialized and what doesn't?
- transient keyword use cases.
- How do you read a large file without loading it all into memory?
- BufferedReader vs Scanner — when to use each?
Design patterns and best practices
Interviewers often ask you to recognize or implement a pattern in Java:
- Singleton — thread-safe implementations (enum, holder, double-checked locking).
- Factory vs Abstract Factory — when to use each.
- Builder pattern — how Lombok @Builder maps to Gang of Four.
- Observer pattern — modern alternatives (reactive streams, event buses).
- Strategy pattern — example with PaymentProcessor interfaces.
- Dependency Injection — how does Spring use it?
- Immutable object design — final fields, defensive copies.
- SOLID principles with Java examples.
- When to prefer composition over inheritance?
- Anti-patterns: God class, spaghetti inheritance, premature abstraction.
Spring and enterprise Java (bonus)
Common in service-company and enterprise product interviews:
- What is the Spring IoC container?
- Difference between @Component, @Service, @Repository, and @Controller.
- @Autowired by type vs by name — what happens with multiple beans?
- Bean scopes: singleton, prototype, request, session.
- How does Spring Boot auto-configuration work?
- @RestController vs @Controller — response handling differences.
- JPA @Entity lifecycle and lazy loading pitfalls.
- N+1 query problem — how do you detect and fix it?
- What is the difference between JDBC and JPA/Hibernate?
- How do you handle transactions with @Transactional?
Memory, performance, and debugging
Senior rounds often probe whether you understand what your code costs at runtime:
- How do you profile a Java application for CPU and memory hotspots?
- What is escape analysis and how can it eliminate allocations?
- StringBuilder vs String concatenation in loops — why does it matter?
- Autoboxing overhead — when does it become a performance issue?
- SoftReference vs WeakReference vs PhantomReference.
- How does the JIT compiler optimize hot code paths?
- What tools do you use to analyze heap dumps (jmap, VisualVM, MAT)?
- How do you debug a production issue you cannot reproduce locally?
- What is the difference between parallel and concurrent collections?
- How do you choose between ArrayList and LinkedList for a real workload?
How to practice effectively
Pick 10 questions per day, answer out loud, then write a short follow-up if your explanation was vague. Pair this list with timed coding practice and AI mock interviews on InterviewVeda to simulate follow-up depth.
- Week 1: OOP + core language rules
- Week 2: Collections + generics
- Week 3: Concurrency + JVM basics
- Week 4: Mixed mocks with behavioral stories
Related articles
Top 75 React Interview Questions You Should Know
Hooks, rendering, performance, state management, and system design angles — everything interviewers ask React developers in 2026.
Priya Sharma
Interview Coach
React Interview Guide: From Junior to Senior
Component design, performance, testing, and architecture questions across experience levels.
Priya Sharma
Interview Coach
System Design Basics for Interview Preparation
Start with requirements, APIs, data models, and scaling — without over-engineering your first answer.
Kavya Reddy
Senior SDE Mentor
Practice what you learned with AI mock interviews and resume tools.
Get started free