
Master Java Interviews
Core Java, OOP, Strings, Collections and HashMap internals, Streams, multithreading, JVM and modern Java 17 / 21.
- 100 questions in 12 chapters
- Output puzzles and coding questions
- JVM, GC and concurrency internals
Core Java, OOP, Collections and HashMap internals, Streams, multithreading, the JVM and Java 17 / 21. Every answer explains what happens underneath and the follow-up the interviewer asks next.
PDF ebookThe Java Interview Handbook is a digital PDF ebook by Target Trek with 100 Java interview questions and answers in 12 chapters, from Java fundamentals and OOP to the Collections Framework, the Stream API, multithreading, JVM memory and modern Java 17 and 21. Every answer explains the internals and the follow-up an interviewer is likely to ask.
Interviewers rarely stop at the definition. They ask why, then what happens if. This book prepares you for the second and third question, not just the first.
Without a plan: Reading random blog posts for every Java topic
With this handbook: 100 curated questions in one structured handbook
Without a plan: Memorising definitions you cannot explain
With this handbook: Answers with the internals, an example and the likely follow-up
Without a plan: Freezing on output and tricky-behaviour questions
With this handbook: Code-output chapters that train you to trace Java line by line
Without a plan: Skipping concurrency and the JVM because they feel hard
With this handbook: Dedicated chapters on threads, locks, memory and garbage collection
100 questions picked from real Java rounds and ordered from basics to internals, so you revise what actually gets asked.
Short snippets, output puzzles and full implementations such as an LRU cache and a thread-safe counter.
How HashMap, the String pool, the JVM heap, garbage collectors and locks really work underneath.
Chapters you can finish in one sitting and a 7-day plan for the week before your interview.
Core Java is the first round, Spring Boot is the backend round and LLD is the design round. Each book stands alone, and together they cover a full Java SDE interview loop.

Core Java, OOP, Strings, Collections and HashMap internals, Streams, multithreading, JVM and modern Java 17 / 21.

IoC and DI, REST APIs, Spring Data JPA, transactions and AOP, Security with JWT, microservices, Redis, Kafka and real scenarios.

Turn requirements into clean object models, apply SOLID and design patterns, and practise complete Java LLD problems.
This is the full list. Filter by difficulty, search for a topic such as HashMap or volatile, and open any chapter to see every question in it.
100 of 100 questions
How Java runs, language basics and the foundational questions every round starts with.
The four pillars, interfaces, inheritance, polymorphism and immutable object design.
String internals, the constant pool, equality, copying and the Object class contract.
Collection types, how they are built inside, their complexity and when to pick which.
Robust error handling, resource management, generics and type erasure.
Lambdas, functional interfaces, Streams, Optional and Collectors in practice.
Thread safety, locks, visibility, deadlocks and the executor framework.
JVM architecture, heap and stack, garbage collectors, class loading and the JIT.
The Java 17 and Java 21 features interviewers now expect you to know.
Trace code like the interviewer does, and write the classic implementations.
Production questions for backend developers: memory, races, latency and caching.
Subtle behaviour that shows up as the follow-up that separates good answers from great ones.
The way every answer is written: a direct reply you can say in the interview, the detail behind it, and the follow-up to expect.
Java is always pass-by-value. For an object, the value that gets copied is the reference, so the method can change the object's state through it, but reassigning the parameter to a new object never changes the caller's variable.
void rename(User u) {
// same object: caller sees it
u.setName("Asha");
// local copy only: caller does not
u = new User("Ravi");
}Likely follow-up: What happens if you reassign the object parameter inside the method?
The single most asked Java internals question. The book walks through it like this, then covers the collisions, resizing and thread-safety follow-ups.
Calls key.hashCode(), then folds the high 16 bits into the low ones.
index = (n − 1) & hash. The table size n is always a power of two.
Same hash and equals() is true: replace the value. Otherwise add a node.
A bucket chains nodes; at 8 nodes (table ≥ 64) it becomes a red-black tree.
Past capacity × load factor the table doubles and nodes are split across buckets.
Real puzzles of the kind the coding chapter trains you on. Pick an answer to see the explanation.
String a = "java";
String b = new String("java");
System.out.println(a == b);
System.out.println(a.equals(b));Implementations from the coding and modern Java chapters, each one a common interview ask.
A classic coding question, answered with a Set inside a stream. The book explains why this lambda has a side effect and when to prefer groupingBy().
import java.util.*;
import java.util.stream.*;
public class FindDuplicates {
public static void main(String[] args) {
List<Integer> numbers = List.of(1, 2, 2, 3, 4, 4);
Set<Integer> seen = new HashSet<>();
List<Integer> duplicates = numbers.stream()
.filter(n -> !seen.add(n)) // add() is false if already present
.distinct()
.toList();
System.out.println(duplicates); // [2, 4]
}
}The last chapters move from definitions to debugging. These are the situations you are asked to reason through out loud.
Memory rises until OutOfMemoryError. How do you find the leak with GC logs, a heap dump and Eclipse MAT?
jcmd <pid> GC.heap_dumpTotals drift only in production. How do you prove a race condition and fix it without killing throughput?
AtomicLong · LongAdderMost requests are fast, some take seconds. Is it GC pauses, lock contention or a saturated thread pool?
jstack · GC logsBuild an in-memory cache with safe concurrent reads, atomic loading and eviction.
ConcurrentHashMap.computeIfAbsentYou put a key, change one of its fields, and get() now returns null. Why, and how do you prevent it?
hashCode() of a mutable keyWhy a visible variable is not an atomic one, and which tool to reach for instead.
count++ = read + add + writeOne focused block a day. The question numbers tell you exactly what to read.
How Java runs, equality, pass-by-value, the four pillars and immutability.
Ch 01–02 · Q1–Q20String pool, equals and hashCode, exception flow, generics and type erasure.
Ch 03, 05 · Q21–Q28, Q41–Q48HashMap internals, ConcurrentHashMap, sets, comparators and iterators.
Ch 04 · Q29–Q40Lambdas, functional interfaces, map vs flatMap, Optional and Collectors.
Ch 06 · Q49–Q60Locks, volatile, deadlocks, executors, CompletableFuture and CAS.
Ch 07 · Q61–Q72Heap, GC, class loading, JIT, records, sealed classes and virtual threads.
Ch 08–09 · Q73–Q88Output puzzles, coding questions, production scenarios and tricky follow-ups. Then say every answer out loud.
Ch 10–12 · Q89–Q100Campus placements and first Java developer interviews, starting from the fundamentals.
One to four years in, switching jobs and needing to explain the internals behind daily code.
Preparing for the Core Java round before Spring Boot, microservices and system design.
Concurrency, JVM and production scenarios for the deeper rounds at product companies.
What you get
Anything else? Write to [email protected]
Yes. It starts with Java fundamentals and object-oriented programming, then moves step by step into Collections, Streams, concurrency, JVM internals and advanced topics. Basic Java syntax is enough to begin.
Core Java, OOP, Strings, the Collections Framework including HashMap internals, exception handling and generics, Java 8 Streams, multithreading and concurrency, JVM memory and garbage collection, modern Java features (records, sealed classes, pattern matching, virtual threads), coding and output questions, real-world scenarios and tricky follow-ups.
Yes. A full chapter covers Java 8 lambdas, functional interfaces, the Stream API and Optional, and another covers modern Java: records, sealed classes, switch expressions, pattern matching, text blocks, sequenced collections and Java 21 virtual threads.
Yes. There are code-output puzzles on String equality, overloading and overriding, plus coding questions such as finding duplicates with Streams, the first non-repeating character, an LRU cache with LinkedHashMap and a thread-safe counter.
Yes. The later chapters go deep into multithreading, locks, CAS, JVM memory, garbage collectors and production scenarios such as debugging memory leaks, race conditions and latency, which are common in SDE-2 rounds.
No. It is an interview preparation handbook built around 100 questions, with explanations, examples and follow-ups. It assumes you can already write basic Java.
Yes. The Spring Boot Interview Handbook has another 100 questions across 10 chapters on Spring Core, REST APIs, JPA, transactions, Spring Security with JWT, microservices, Redis, Kafka and real backend scenarios. Both books are shown in the series section on this page.
It is a digital PDF ebook, not a physical book. After your payment is confirmed you get access through Target Trek's ebook delivery flow, and you can read it on any phone, tablet or laptop.
Digital purchases are non-refundable. For payment or access help, email [email protected].
100 questions, 12 chapters, real code and the internals behind every answer, in one PDF you can read anywhere.