Master Java 17 for Technical Interviews
Primitives, OOP, generics, collections, streams, lambdas, concurrency, virtual threads, memory + GC, records, sealed classes, pattern matching. 40 lessons with interactive simulators of every JVM concept and hundreds of interview gotchas.
Let’s figure it out.
Ask me about this course or where to start.
- Step 1
Java 1: Primitives, Wrappers & Autoboxing
Java has 8 primitive types and a wrapper class for each. Autoboxing turns primitives into wrappers a...
Start Lesson - Step 2
Java 2: Strings, Immutability & StringBuilder
Strings in Java are immutable objects stored in a special String Pool. Every concatenation creates a...
Start Lesson - Step 3
Java 3: Control Flow, Labels & Early Returns
Java's control flow is familiar — `if`, `for`, `while`, `do-while`, `switch` — but Java has two feat...
Start Lesson - Step 4
Java 4: Arrays, Varargs & Defensive Copies
Java arrays are fixed-size, covariant, and reified (they know their element type at runtime) — unlik...
Start Lesson - Step 5
Java 5: Methods, Overloading & the main Signature
Method overloading resolves at **compile time** (static binding) based on the *declared* type of the...
Start Lesson - Step 6
Java 6: Classes, Constructors & this/super
Every Java class has a **constructor** — either one you write or a compiler-inserted zero-arg defaul...
Start Lesson - Step 7
Java 7: Inheritance & Method Overriding
Overriding replaces a parent method with a child version at runtime. Rules: same name + parameter ty...
Start Lesson - Step 8
Java 8: Polymorphism, Abstract & Interface
Both **abstract classes** and **interfaces** define contracts, but they're not interchangeable. Abst...
Start Lesson - Step 9
Java 9: Composition over Inheritance
Inheritance creates a tight coupling that's hard to change — the LSP (Liskov Substitution Principle)...
Start Lesson - Step 10
Java 10: Sealed Classes (Java 17)
**Sealed classes** (Java 17) let a type declare its permitted subclasses explicitly. The compiler ca...
Start Lesson - Step 11
Java 11: Records & Value Semantics (Java 16)
**Records** (Java 16) are compact, immutable data carriers. One line — `record Point(int x, int y) {...
Start Lesson - Step 12
Java 12: Generic Classes & Methods
Generics give you compile-time type safety without casts. A `Box<T>` can hold any type, and the comp...
Start Lesson - Step 13
Java 13: Wildcards & PECS
`? extends T` is a **producer** bound — you can only **read** T out of it. `? super T` is a **consum...
Start Lesson - Step 14
Java 14: Type Erasure & Bridge Methods
At runtime, `List<String>` and `List<Integer>` are both just `List` — the type parameters are **eras...
Start Lesson - Step 15
Java 15: Bounded Type Parameters
`<T extends Comparable<T>>` says T must implement `Comparable<T>`. Bounds let you call methods on T ...
Start Lesson - Step 16
Java 16: var, Type Inference & Lambdas
Java 10's `var` keyword gives you local type inference — the compiler figures out the type from the ...
Start Lesson - Step 17
Java 17: ArrayList vs LinkedList
`ArrayList` is backed by a resizing array: O(1) random access, O(n) insertion in the middle. `Linked...
Start Lesson - Step 18
Java 18: HashMap Internals
`HashMap` is an array of buckets (default 16), each a chain of `Node(hash, key, value, next)`. Looku...
Start Lesson - Step 19
Java 19: equals/hashCode Contract
Break the `equals`/`hashCode` contract and your objects silently disappear from HashMaps and HashSet...
Start Lesson - Step 20
Java 20: TreeMap & Sorted Collections
`TreeMap` is a red-black tree — O(log n) ops, ordered iteration, and range queries (`headMap`, `subM...
Start Lesson - Step 21
Java 21: ConcurrentHashMap & Lock Striping
`ConcurrentHashMap` (CHM) is thread-safe without locking the whole table. Java 8+ uses **fine-graine...
Start Lesson - Step 22
Java 22: CopyOnWriteArrayList & When It Wins
`CopyOnWriteArrayList` copies the entire backing array on every **write**. Reads are lock-free and c...
Start Lesson - Step 23
Java 23: Lambdas & Functional Interfaces
A **functional interface** has exactly one abstract method. Lambdas (`x -> x * 2`) are syntactic sug...
Start Lesson - Step 24
Java 24: Stream API — Lazy Evaluation
Streams are **lazy pipelines**: intermediate ops (filter, map, peek) do nothing until a terminal op ...
Start Lesson - Step 25
Java 25: Collectors — groupingBy, partitioningBy, joining
`Collectors` produces the final result of a stream — `toList()`, `toMap()`, `groupingBy(keyFn)`, `pa...
Start Lesson - Step 26
Java 26: Parallel Streams — When They Help
`.parallelStream()` uses the common `ForkJoinPool` to split work across CPU cores. Sounds free — it ...
Start Lesson - Step 27
Java 27: Optional — Avoiding Null
`Optional<T>` is Java's way to signal 'may or may not have a value' without returning `null`. Used r...
Start Lesson - Step 28
Java 28: Thread, Runnable & Thread.start vs run
A `Thread` is a real OS-backed thread (until Loom changed that). `Runnable` is just a 'piece of work...
Start Lesson - Step 29
Java 29: synchronized, volatile, Atomic
Three tools for safe concurrent state: `synchronized` (mutual exclusion via monitor), `volatile` (vi...
Start Lesson - Step 30
Java 30: ExecutorService & Thread Pools
Don't spawn raw `Thread`s — use an `ExecutorService`. Submit `Runnable`s or `Callable`s, get back a ...
Start Lesson - Step 31
Java 31: CompletableFuture Composition
`CompletableFuture<T>` is the composable async type — `thenApply` (sync transform), `thenCompose` (a...
Start Lesson - Step 32
Java 32: Virtual Threads (Project Loom)
**Virtual threads** (Java 21) are JVM-scheduled threads — millions of them fit in memory, context sw...
Start Lesson - Step 33
Java 33: BlockingQueue & Producer-Consumer
`BlockingQueue` is the concurrent backbone of producer-consumer pipelines. `ArrayBlockingQueue` (bou...
Start Lesson - Step 34
Java 34: Heap, Stack & Generational Memory
The JVM heap is split into generations: **Young** (Eden + 2 Survivor spaces) and **Old**. Most objec...
Start Lesson - Step 35
Java 35: GC Algorithms — G1, ZGC, Shenandoah
Java ships multiple GC algorithms. **G1** (default since Java 9) targets predictable pauses on large...
Start Lesson - Step 36
Java 36: Class Loading & the Delegation Model
Java's **classloaders** load `.class` files on demand. Three built-in loaders: **Bootstrap** (core J...
Start Lesson - Step 37
Java 37: Reference Types — Strong, Soft, Weak, Phantom
Java has four reference strengths, from most to least reachable: **strong** (normal), **soft** (clea...
Start Lesson - Step 38
Java 38: Pattern Matching for instanceof & switch
Pattern matching (Java 16+ for instanceof, Java 21 for switch) eliminates the 'cast boilerplate' and...
Start Lesson - Step 39
Java 39: Text Blocks, Switch Expressions & Java 8→17 Recap
The most interview-relevant modern features: text blocks, switch expressions, `var`, records, sealed...
Start Lesson - Step 40
Java 40: Interview Capstone — Thread-Safe Bounded LRU Cache
The capstone: design a thread-safe bounded LRU cache in Java. This question comes up in every senior...
Start Lesson - Step 41
Java 41: Exception Hierarchy — Checked vs Unchecked & Custom Exceptions
Everything throwable descends from `Throwable`. The split that matters for design is **checked** (`E...
Start Lesson - Step 42
Java 42: try-with-resources & AutoCloseable
Before Java 7, closing resources meant a nested `try/finally` dance that was easy to get wrong. **tr...
Start Lesson - Step 43
Java 43: Enums with Fields, Methods & EnumMap/EnumSet
Java enums are full classes: each constant is a singleton instance, they can carry **fields**, defin...
Start Lesson - Step 44
Java 44: Comparator Chaining — thenComparing, reversed & nullsFirst
Sorting by multiple keys used to mean hand-written, error-prone comparison logic. Modern `Comparator...
Start Lesson - Step 45
Java 45: ArrayDeque — Stack, Queue & the Deque API
`Deque` ('deck') is a double-ended queue — the one collection that subsumes both stack and queue. `A...
Start Lesson - Step 46
Java 46: Iterators, Iterable & Fail-Fast vs Fail-Safe
The for-each loop is sugar over `Iterator`. Implementing `Iterable` makes your type loopable; unders...
Start Lesson - Step 47
Java 47: Stream Collectors Deep Dive — toMap, flatMap & teeing
Beyond `toList`, the `Collectors` toolkit assembles maps, flattens nested structures, and computes s...
Start Lesson - Step 48
Java 48: Nested, Inner, Local & Anonymous Classes
Java has four flavors of nested class, and the difference between *static nested* and *inner* is a c...
Start Lesson - Step 49
Java 49: java.time — LocalDate, Duration, Period & ZonedDateTime
The Java 8 `java.time` API (JSR-310) replaced the broken, mutable `Date`/`Calendar`. Its types are *...
Start Lesson - Step 50
Java 50: BigDecimal — Money, Precision & RoundingMode
`0.1 + 0.2 != 0.3` in `double` — binary floating point can't represent most decimal fractions exactl...
Start Lesson - Step 51
Java 51: Annotations & Reflection Basics
Annotations attach metadata to code; reflection reads that metadata (and structure) at runtime. Toge...
Start Lesson - Step 52
Java 52: The Builder Pattern & Fluent APIs
When a class has many optional fields, telescoping constructors and giant parameter lists become unr...
Start Lesson - Step 53
Java 53: Stream Pipelines — map, filter & collect
A `Stream` pipeline has three parts: a **source** (a collection, array, or generator), zero or more ...
Start Lesson - Step 54
Java 54: Sorting & Comparator Mechanics
`Collections.sort` / `List.sort` / `Arrays.sort` for objects use a **stable** TimSort and need a tot...
Start Lesson - Step 55
Java 55: Recursion & the Call Stack
Every method call pushes a **stack frame** holding its parameters and locals; the call returns by po...
Start Lesson - Step 56
Java 56: Functional Composition — andThen & compose
Java's functional interfaces aren't just lambdas — they carry **default methods** that combine them....
Start Lesson - Step 57
Java 57: Map merge, computeIfAbsent & getOrDefault
Java 8 gave `Map` a family of atomic, single-lookup update methods that retire the old 'get, check n...
Start Lesson - Step 58
Java 58: PriorityQueue & the Binary Heap
`PriorityQueue` is a `Queue` whose `poll` always returns the **smallest** element by natural order o...
Start Lesson