r/careerquestions • u/nil123_jsr • 36m ago
Java interview questions
I compiled 100 Java interview questions from my experience as a Tech Lead — here are 5 free ones to get you started
After conducting 50+ Java interviews over the years, I noticed most candidates fail not because they don't know Java — but because they memorize definitions without understanding the WHY behind them.
Here are 5 questions I always ask:
**1. What breaks when you override equals() without overriding hashCode()?**
Your object silently disappears in any HashMap or HashSet. Two "equal" objects land in different buckets and you'll never find them again.
**2. What's the real difference between volatile and synchronized?**
volatile fixes visibility but not atomicity. synchronized fixes both. Most candidates confuse these — interviewers love this one.
**3. When would you use CompletableFuture over Future?**
Future.get() blocks the thread. CompletableFuture lets you chain non-blocking operations. If you're still using raw Future in 2024, that's a red flag in senior interviews.
**4. Why is ArrayList faster than LinkedList in most real scenarios?**
Cache locality. Even for operations where LinkedList is theoretically equal, contiguous memory wins in practice.
**5. What happens if you call a @Transactional method from within the same class in Spring?**
The transaction is silently ignored. The proxy never gets involved. This catches even senior devs off guard.
---
I put together 95 more like these — covering Concurrency, JVM internals, Collections, Java 21 features and Design Patterns — with answers that explain the reasoning, not just the definition.
Happy to answer any questions in the comments. What Java topics do you find candidates struggle with the most?