Skip to content

Boarding pass · Java Intermediate

Java · Intermediate interview

An AI mock interview for Java developers with a couple of years' experience. Go deeper into generics, collection internals, the Stream API, and concurrency basics.

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

  • Developers writing Java daily
  • Engineers building real Java services
  • Anyone targeting mid-level Java roles
  • Devs sharpening before interviews

What you'll practice

  • Generics, wildcards and the equals/hashCode contract
  • HashMap internals and comparators
  • The Stream API and Optional
  • Threads, executors and thread safety

Topics covered

What this level expects.

Generics & types

  • Generics & erasure
  • Wildcards
  • equals/hashCode

Collections

  • HashMap internals
  • Comparable vs Comparator
  • Fail-fast iterators

Streams

  • Stream API
  • Lazy evaluation
  • Optional

Concurrency

  • Threads & executors
  • synchronized & volatile
  • Immutability

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 is type erasure in Java generics?

Generics are a compile-time feature: the compiler checks types and inserts casts, then erases the type parameters so the bytecode uses raw types (Object or the bound). This means generic type info isn't available at runtime — you can't do new T(), instanceof List<String>, or get the actual type via reflection easily. It's why generics interoperate with legacy code but have these runtime limitations.

02How do bounded types and wildcards (? extends / ? super) work?

A bound constrains a type parameter (<T extends Number>). Wildcards add flexibility: ? extends T is an upper-bounded producer you can read T from but not write to; ? super T is a lower-bounded consumer you can write T into. The PECS rule — Producer Extends, Consumer Super — guides which to use, e.g. copying from a source (extends) to a destination (super).

03What is the equals/hashCode contract?

If two objects are equal by equals(), they must have the same hashCode; unequal objects should ideally have different hashes but aren't required to. If you override equals you must override hashCode consistently, or the object misbehaves in HashMaps/HashSets (lookups fail). Both should be based on the same significant fields, and equal objects should stay equal (immutability helps).

04How does a HashMap handle collisions and resizing?

Entries hash to buckets; collisions (same bucket) are chained in a linked list, which converts to a balanced tree when a bucket gets large (8+ in modern JDKs) to keep worst-case lookups O(log n). When the load factor (default 0.75) is exceeded it resizes — doubling capacity and rehashing entries. Good hashCode distribution keeps buckets small and lookups near O(1).

05What's the difference between Comparable and Comparator?

Comparable defines a type's natural ordering via compareTo, implemented by the class itself (one ordering). Comparator is a separate object defining an ordering externally, so you can have many and sort the same type different ways without modifying it. You use Comparable for the default sort order and Comparators for alternative or ad-hoc orderings.

06What is a fail-fast iterator and ConcurrentModificationException?

Most collection iterators are fail-fast: if the collection is structurally modified during iteration (other than through the iterator), they throw ConcurrentModificationException to flag a likely bug rather than risk undefined behaviour. To modify while iterating, use the iterator's own remove, collect changes and apply after, or use a concurrent collection. It's a safety mechanism, not a guarantee.

07What is the Stream API and how do you use it?

Streams provide a functional, declarative way to process collections — you chain operations like filter, map, and collect instead of writing loops. A stream pipeline has a source, intermediate operations (lazy, returning a stream), and one terminal operation that produces a result or side effect. It makes data transformations concise and enables easy parallelism with parallelStream.

List<String> names = users.stream()
  .filter(u -> u.getAge() >= 18)
  .map(User::getName).toList();
08What's the difference between intermediate and terminal operations, and why does laziness matter?

Intermediate operations (filter, map, sorted) are lazy — they build up a pipeline and don't execute until a terminal operation (collect, forEach, reduce, count) is invoked. Laziness lets the stream fuse operations and short-circuit (e.g. findFirst stops early), processing each element through the whole chain once rather than materializing intermediate collections. Without a terminal op, nothing runs.

09What is Optional and how should you use it?

Optional is a container that may or may not hold a value, designed to make absence explicit and reduce NullPointerExceptions — mainly as a return type for methods that might not find a result. You handle it with map, filter, orElse, or ifPresent rather than get(). It's not meant for fields or method parameters; it's a return-value tool to force callers to consider the empty case.

10Why prefer ExecutorService over creating Threads directly?

Creating raw Threads per task is expensive and unbounded — it can exhaust resources under load. An ExecutorService manages a reusable thread pool, queues tasks, bounds concurrency, and returns Futures for results, separating task submission from execution. It's the standard way to run concurrent work, and you size the pool to the workload (CPU- vs I/O-bound).

11What's the difference between synchronized and volatile?

synchronized provides mutual exclusion (only one thread in the block at a time) and visibility, protecting compound actions on shared state. volatile only guarantees visibility — reads/writes go to main memory so threads see the latest value — but not atomicity for compound operations like i++. Use volatile for a simple flag read by many threads, synchronized (or locks/atomics) when you need atomic multi-step updates.

12Why does immutability help with thread safety?

An immutable object can't change after construction, so it can be shared freely between threads with no synchronization — there's no state to corrupt and no visibility problem. You make a class immutable with final fields, no setters, defensive copies of mutable inputs, and a final class. It's the simplest, safest concurrency strategy and underlies value types like String.

Preparation tips

Walk in ready.

  • Know the PECS rule for wildcards
  • Be able to explain the equals/hashCode contract
  • Practise a stream that maps, filters, and collects
  • Prefer ExecutorService over raw threads

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 intermediate interviews

Aevrofy · Java intermediate interview prep