Effective Java — Study Notes
Structured study notes for Joshua Bloch’s “Effective Java” (3rd Edition, 2018) with Java 17 updates, interview exercises, and Obsidian flashcards.
Book Information
- Title: Effective Java, 3rd Edition
- Author: Joshua Bloch
- Published: January 2018
- Target Java Version: Java 8 (items updated here for Java 17)
- Focus: Best practices, design patterns, and idiomatic Java
- Total Items: 90 items across 11 chapters
Structure
EffectiveJava-Notes/
├── README.md ← This file
├── chapters/
│ ├── ch01-creating-objects.md ← Items 1-9
│ ├── ch02-methods-objects.md ← Items 10-14
│ ├── ch03-classes-interfaces.md ← Items 15-25
│ ├── ch04-generics.md ← Items 26-33
│ ├── ch05-enums-annotations.md ← Items 34-41
│ ├── ch06-lambdas-streams.md ← Items 42-48
│ ├── ch07-methods.md ← Items 49-56
│ ├── ch08-general-programming.md ← Items 57-68
│ ├── ch09-exceptions.md ← Items 69-77
│ ├── ch10-concurrency.md ← Items 78-84
│ └── ch11-serialization.md ← Items 85-90
└── flashcards/
├── ch01-flashcards.md
├── ch02-flashcards.md
├── ch03-flashcards.md
├── ch04-flashcards.md
├── ch05-flashcards.md
├── ch06-flashcards.md
├── ch07-flashcards.md
├── ch08-flashcards.md
├── ch09-flashcards.md
├── ch10-flashcards.md
└── ch11-flashcards.md
Chapter Index
| # | Chapter | Items | Key Topics |
|---|---|---|---|
| 1 | Creating and Destroying Objects | 1–9 | Static factory methods, Builder pattern, singleton, dependency injection, avoid unnecessary objects, finalizers, try-with-resources |
| 2 | Methods Common to All Objects | 10–14 | equals contract, hashCode, toString, clone, Comparable |
| 3 | Classes and Interfaces | 15–25 | Minimize accessibility, immutability, composition over inheritance, interface design, abstract classes, sealed classes |
| 4 | Generics | 26–33 | Erasure, raw types, type safety, bounded wildcards, PECS, generic methods, heterogeneous containers |
| 5 | Enums and Annotations | 34–41 | Enum internals, EnumSet, EnumMap, instance fields in enums, strategy enum pattern, annotation processor basics |
| 6 | Lambdas and Streams | 42–48 | Functional interfaces, lambda vs anonymous class, method references, stream pipelines, flatMap, Optional |
| 7 | Methods | 49–56 | Parameter validation, defensive copies, method signatures, Optional return, varargs, overloading pitfalls |
| 8 | General Programming | 57–68 | Local variable scope, for-each, libraries, float/double vs BigDecimal, boxed primitives, string concatenation, reflection, native methods, optimization, naming |
| 9 | Exceptions | 69–77 | Checked vs unchecked, standard exceptions, exception chaining, failure atomicity, ignoring exceptions |
| 10 | Concurrency | 78–84 | Shared mutable state, synchronization, volatile, executors, concurrent collections, wait/notify, thread safety documentation |
| 11 | Serialization | 85–90 | Avoid Java serialization, implement with caution, custom form, defensive readObject, enum for instance control, serialization proxy |
Java 17 Upgrade Summary
| Item | Original Advice (Java 8) | Java 17 Update |
|---|---|---|
| Item 1 | Static factory methods | No change; factory methods remain the preferred pattern |
| Item 2 | Builder pattern for 4+ params | Records (Java 16+) eliminate builders for pure data classes |
| Item 3 | Singleton via private constructor | Enum singleton still best; no change |
| Item 9 | try-with-resources | No change |
| Item 13 | Override clone judiciously | Records are not cloneable; use copy constructors |
| Item 14 | Consider implementing Comparable | Records auto-generate no Comparable; implement explicitly |
| Item 15 | Minimize mutability | Records (Java 16+) make immutable data classes concise |
| Item 17 | Minimize mutability | Sealed classes (Java 17) for closed hierarchies of immutable types |
| Item 28 | Prefer lists to arrays | No change; generics + arrays still don’t mix |
| Item 34 | Use enums instead of int constants | No change; enums remain canonical |
| Item 36 | Use EnumSet | No change |
| Item 42 | Prefer lambdas to anonymous classes | No change; switch expressions (Java 14) complement lambdas |
| Item 55 | Return Optional judiciously | No change; avoid Optional in fields, collections, arrays |
| Item 63 | Beware string concatenation performance | Text blocks (Java 15) for multi-line strings; StringBuilder still for loops |
| Item 78 | Synchronize access to shared mutable data | VarHandle (Java 9) for fine-grained memory access |
| Item 80 | Executor framework over raw threads | Virtual threads (Java 21 preview in 17 era) — major shift for I/O-bound work |
| Item 85 | Prefer alternatives to Java serialization | JEP 415 (Java 17): Context-specific deserialization filters; still use JSON/Protobuf |
| Item 86 | Implement Serializable with caution | Records (Java 16+) with canonical constructor enforcement — safer for value types |
| Item 88 | Write readObject defensively | Records auto-invoke canonical constructor on deserialization — invariants enforced |
| Item 90 | Serialization proxy pattern | Records replace the proxy pattern for simple value types |
Study Path
Quick Review (1–2 hours total, one pass per chapter)
Focus on the “Key Takeaways” section and the flashcards for each chapter.
Day 1: Ch1 (objects) + Ch2 (equals/hashCode) ~30 min
Day 2: Ch3 (classes/interfaces) + Ch4 (generics) ~40 min
Day 3: Ch5 (enums) + Ch6 (lambdas/streams) ~35 min
Day 4: Ch7 (methods) + Ch8 (general) ~40 min
Day 5: Ch9 (exceptions) + Ch10 (concurrency) ~35 min
Day 6: Ch11 (serialization) ~20 min
Day 7: Flashcard review (all chapters) ~45 min
Deep Review (interview preparation, ~8 hours)
Read the full chapter notes including “The Problem / The Solution / Why This Works” sections, work through the interview questions, and implement the code examples.
Session 1 (2h): Ch1–Ch3 — Object creation, equals/hashCode, class design
Session 2 (2h): Ch4–Ch6 — Generics, enums, streams (high interview frequency)
Session 3 (2h): Ch7–Ch9 — Methods, general programming, exceptions
Session 4 (2h): Ch10–Ch11 — Concurrency (critical for senior roles), serialization
High-Priority Items for Interviews
The following items appear most frequently in Java technical interviews:
- Item 1 — Static factory vs constructor (builder factories,
of,from,getInstance) - Item 2 — Builder pattern (when and how to use it)
- Item 10–11 —
equalsandhashCodecontracts (HashMap behavior) - Item 17 — Immutability (thread safety, defensive copies)
- Item 27–29 — Generics, type erasure, PECS
- Item 34 — Enums vs int constants (enum internals,
EnumSet) - Item 42–45 — Lambdas, streams, method references
- Item 55 —
Optionalusage - Item 69–70 — Checked vs unchecked exceptions
- Item 78–80 — Synchronization,
volatile, executor framework - Item 85 — Java serialization dangers (security interviews)
How to Use
Obsidian Flashcard Setup
These notes use the Obsidian Spaced Repetition plugin format. Cards are separated by --- and answers follow ?.
- Install the Spaced Repetition plugin in Obsidian.
- Open any
*-flashcards.mdfile. - Press the plugin’s “Review” button or use the command palette (
Review flashcards in this file). - Cards are automatically scheduled based on your recall quality.
Study Workflow
- First pass: Read the chapter notes (Overview + Items). Focus on “The Problem” and “The Solution.”
- Second pass: Work through the Interview Questions. Try to answer before reading the provided answer.
- Flashcard review: Review the chapter’s flashcard file. Rate cards honestly (again/hard/good/easy).
- Code: Implement at least one of the bad/good code examples from each item in an IDE. Running the code is more memorable than reading it.
- Spaced repetition: Return to flashcards daily for 10–15 minutes until all cards are scheduled weeks out.
Tags Reference
#effective-java— all notes in this set#serialization— Chapter 11 notes#flashcards— all flashcard files#best-practices— patterns applicable to daily coding#java— general Java tag
Last Updated: 2026-05-10