Skip to content

Boarding pass · Java Advanced

Java · Advanced interview

An AI mock interview for senior Java engineers. Reason about JVM internals, garbage collection and the memory model, advanced concurrency, and performance tuning.

20–30 minEstimated6 questionsTailored live12 model answersTo study
  • Voice interview
  • Live feedback
  • Browser-only
  • No installation required

Your report · sample

AI Readiness Score

/100
Content score English score

Finish the mock and get this report — scored on content and English, with concrete tips and a model answer for every question, plus a study plan.

Your flight path

Five steps to interview-ready.

From a quick warm-up to a personalised study plan — here's the whole loop, and what you get at each gate.

  1. Step 01

    Preparation

    Skim the topics and warm up — you're briefed before takeoff.

  2. Step 02

    AI Interview

    A realistic AI interviewer asks tailored questions — answer by voice or text.

  3. Step 03

    Instant Score

    Finish and get a 0–100 readiness score across content and English.

  4. Step 04

    AI Feedback

    Concrete tips and a rewritten model answer for every response.

  5. Step 05

    Study Plan

    A personalised plan targets your weakest areas — so the next run scores higher.

Preview the AI demo

See one answer scored, end to end.

The whole loop on sample data — question, your answer, instant feedback and a study plan. Hover to pause.

aevrofy.com/session · live demoPlaying

Interviewer · Question 1

“Tell me about yourself.”

Who it's for

  • Senior Java engineers
  • Devs who tune JVM-based services
  • Anyone targeting senior/lead Java roles
  • Engineers debugging concurrency and GC

What you'll practice

  • JVM memory areas, classloading and JIT
  • GC algorithms and reference types
  • Concurrent collections, futures and locks
  • Profiling and JVM performance tuning

Topics covered

What this level expects.

JVM internals

  • Memory areas
  • Classloading
  • JIT compilation

Memory & GC

  • GC algorithms
  • Reference types
  • Java Memory Model

Concurrency

  • Concurrent collections
  • CompletableFuture
  • Locks

Performance

  • Profiling & tuning
  • String handling
  • Common pitfalls

Practice questions

12 questions, with model answers.

Read them, then run the live mock to answer out loud and get scored. Tap any question to reveal a model answer.

01What are the main JVM memory areas?

The heap holds all objects and is shared across threads and GC-managed, split into young and old generations. Each thread has its own stack of frames for method calls and local variables/primitives. The Metaspace (native memory, post-Java 8) holds class metadata. There's also the program counter per thread and native method stacks. Most tuning and leaks concern the heap.

02How does classloading work in Java?

Class loaders load classes lazily on first use, following the parent-delegation model: a loader asks its parent before loading itself, so core classes come from the bootstrap loader and can't be overridden. The process is load → link (verify, prepare, resolve) → initialize (run static initializers). Custom class loaders enable plugins, hot reloading, and isolation (e.g. in app servers), but delegation prevents tampering with core classes.

03What is JIT compilation?

The JVM starts by interpreting bytecode, and the Just-In-Time compiler compiles hot methods to native code at runtime, applying optimizations (inlining, escape analysis, loop optimizations) based on actual execution profiles. Tiered compilation balances fast startup with peak performance. This is why Java 'warms up' — performance improves after the JIT optimizes hot paths, and why micro-benchmarks must account for warmup.

04How does generational garbage collection work?

The heap is split into a young generation (where new objects are allocated and most die quickly) and an old generation. Minor GCs collect the young gen cheaply, promoting survivors to old; major/full GCs collect the old gen less often but more expensively. This generational hypothesis — most objects die young — makes collection efficient. Modern collectors like G1 and ZGC add region-based, mostly-concurrent collection for low pause times.

05What are the different reference types and how do they affect GC?

Strong references (normal) keep objects alive. Soft references are cleared only under memory pressure — good for caches. Weak references are cleared at the next GC once no strong refs remain — used by WeakHashMap for canonicalizing maps/metadata. Phantom references are for cleanup actions after collection. They let you build memory-sensitive structures that cooperate with GC instead of leaking.

06What does the Java Memory Model guarantee with happens-before?

The JMM defines when one thread's writes become visible to another. The happens-before relation orders actions so that if A happens-before B, A's effects are visible to B. It's established by synchronization: unlocking a monitor happens-before locking it, a volatile write happens-before subsequent reads, thread start/join, and final-field publication. Without these, the compiler/CPU may reorder or cache, so reasoning about correctness means establishing happens-before edges.

07How does ConcurrentHashMap achieve thread safety efficiently?

Instead of locking the whole map like Hashtable, ConcurrentHashMap allows concurrent reads with no locking and locks only individual bins/nodes (via CAS and synchronized on bin heads) for writes, so multiple threads update different buckets in parallel. This gives high concurrency. Its iterators are weakly consistent (no ConcurrentModificationException), and operations like computeIfAbsent are atomic per key.

08What does CompletableFuture give you over a plain Future?

A Future only lets you block for a result; CompletableFuture lets you compose asynchronous pipelines — chaining with thenApply/thenCompose, combining with thenCombine/allOf, and handling errors with exceptionally/handle — without blocking. You can run stages on specific executors and build non-blocking, callback-style flows. It's Java's tool for composable async, akin to promises.

09When would you use an explicit Lock instead of synchronized?

synchronized is simple and sufficient for most mutual exclusion. ReentrantLock and ReadWriteLock add capabilities: tryLock with timeout, interruptible locking, fairness policies, multiple condition variables, and a read-write split so many readers proceed concurrently while writers are exclusive. You reach for them when you need those features or finer control; otherwise synchronized is cleaner and now performs comparably.

10How do you profile and tune a JVM application?

Profile with tools like async-profiler, JFR (Java Flight Recorder), or VisualVM to find CPU hotspots, allocation pressure, lock contention, and GC behaviour before changing anything. Tune by choosing/sizing the right collector (G1/ZGC), setting heap sizes, and reducing allocations; analyze GC logs for pause times and frequency. The discipline is measure → change one thing → re-measure, not speculative flag-twiddling.

11What should you know about String handling for performance?

Strings are immutable, so concatenation in a loop creates many temporary objects — use StringBuilder for building strings incrementally. The String pool interns string literals so identical literals share one instance (another reason == is unreliable for content). Be mindful that substring and heavy string work allocate; for hot paths consider char arrays or avoiding unnecessary conversions between String and byte[].

12What are common Java performance pitfalls?

Autoboxing in hot loops creating garbage, excessive object allocation pressuring GC, unbounded caches or listener lists leaking memory, using the wrong collection (LinkedList where ArrayList fits, or not sizing collections), over-synchronization causing contention, and N+1 patterns in data access. Many show up as GC pressure or lock contention in a profile — the fix is reducing allocations, right-sizing data structures, and narrowing critical sections.

Preparation tips

Walk in ready.

  • Be able to explain heap vs stack vs metaspace
  • Know strong/soft/weak/phantom references
  • Explain happens-before and why volatile establishes it
  • Have a JVM tuning/profiling story ready

Ready for the real thing?

Run a 6-question Java mock interview, answer out loud, and get a readiness score with tips and model answers.

More advanced interviews

Aevrofy · Java advanced interview prep