guides · intermediate



How interviewers think


Senior Java rounds rarely ask “what is inheritance?” They probe whether you have debugged real systems — memory leaks, race conditions, slow GC, poison messages.


In plain English: For every concept, prepare two sentences — one simple explanation, one production example from your experience (or a realistic hypothetical).


Collections — what to master

  • HashMap — hash spread, resize, treeify threshold, mutable keys, thread safety.
  • ConcurrentHashMap — why it replaced synchronized HashMap; CAS vs locking.
  • ArrayList vs LinkedList — random access vs insert cost; know when neither is right (use deque or specialized structures).
  • Fail-fast iterators — ConcurrentModificationException and safe patterns.

Whiteboard tip: Draw bucket array + linked list / tree for collision — interviewers love seeing you know post–Java 8 internals.

Concurrency — expected depth

  • volatile vs synchronized vs java.util.concurrent atomics.
  • Thread pool sizing — CPU-bound vs I/O-bound; avoid unbounded queues in production.
  • Virtual threads (21+) — great for blocking I/O; watch pinned carriers on synchronized blocks.
  • Common bugs: check-then-act races, deadlocks (lock ordering), lost interrupts.

JVM & performance

  • G1 vs ZGC — when low pause matters (trading, real-time dashboards).
  • Heap vs metaspace vs direct memory — Full GC with empty heap → suspect off-heap leak.
  • Flags you actually used: -XX:+HeapDumpOnOutOfMemoryError, GC logs, async profiler.

Spring (when role is backend)

Expect dependency injection lifecycle, @Transactional pitfalls (self-invocation, rollback rules), and actuator health vs readiness. Tie answers to microservices you shipped.

Use the Code Lab

Before an onsite, step through HashMap and concurrency snippets in Code Lab. Say the output out loud, then check. Muscle memory beats passive reading.

Suggested study order

  1. HashMap internals article → HashMap MCQ banks
  2. Concurrency article → Concurrency MCQ banks
  3. JVM tuning article → JVM MCQ banks
  4. Flashcards daily — 10 cards minimum

Track: Engineering Foundations

Previous: How to Use This Learning Platform

Next: Payments Interview Cheatsheet

By Shubham Jain

All articles · Study paths

Shubham Jain · Learning Lab