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

#ChapterItemsKey Topics
1Creating and Destroying Objects1–9Static factory methods, Builder pattern, singleton, dependency injection, avoid unnecessary objects, finalizers, try-with-resources
2Methods Common to All Objects10–14equals contract, hashCode, toString, clone, Comparable
3Classes and Interfaces15–25Minimize accessibility, immutability, composition over inheritance, interface design, abstract classes, sealed classes
4Generics26–33Erasure, raw types, type safety, bounded wildcards, PECS, generic methods, heterogeneous containers
5Enums and Annotations34–41Enum internals, EnumSet, EnumMap, instance fields in enums, strategy enum pattern, annotation processor basics
6Lambdas and Streams42–48Functional interfaces, lambda vs anonymous class, method references, stream pipelines, flatMap, Optional
7Methods49–56Parameter validation, defensive copies, method signatures, Optional return, varargs, overloading pitfalls
8General Programming57–68Local variable scope, for-each, libraries, float/double vs BigDecimal, boxed primitives, string concatenation, reflection, native methods, optimization, naming
9Exceptions69–77Checked vs unchecked, standard exceptions, exception chaining, failure atomicity, ignoring exceptions
10Concurrency78–84Shared mutable state, synchronization, volatile, executors, concurrent collections, wait/notify, thread safety documentation
11Serialization85–90Avoid Java serialization, implement with caution, custom form, defensive readObject, enum for instance control, serialization proxy

Java 17 Upgrade Summary

ItemOriginal Advice (Java 8)Java 17 Update
Item 1Static factory methodsNo change; factory methods remain the preferred pattern
Item 2Builder pattern for 4+ paramsRecords (Java 16+) eliminate builders for pure data classes
Item 3Singleton via private constructorEnum singleton still best; no change
Item 9try-with-resourcesNo change
Item 13Override clone judiciouslyRecords are not cloneable; use copy constructors
Item 14Consider implementing ComparableRecords auto-generate no Comparable; implement explicitly
Item 15Minimize mutabilityRecords (Java 16+) make immutable data classes concise
Item 17Minimize mutabilitySealed classes (Java 17) for closed hierarchies of immutable types
Item 28Prefer lists to arraysNo change; generics + arrays still don’t mix
Item 34Use enums instead of int constantsNo change; enums remain canonical
Item 36Use EnumSetNo change
Item 42Prefer lambdas to anonymous classesNo change; switch expressions (Java 14) complement lambdas
Item 55Return Optional judiciouslyNo change; avoid Optional in fields, collections, arrays
Item 63Beware string concatenation performanceText blocks (Java 15) for multi-line strings; StringBuilder still for loops
Item 78Synchronize access to shared mutable dataVarHandle (Java 9) for fine-grained memory access
Item 80Executor framework over raw threadsVirtual threads (Java 21 preview in 17 era) — major shift for I/O-bound work
Item 85Prefer alternatives to Java serializationJEP 415 (Java 17): Context-specific deserialization filters; still use JSON/Protobuf
Item 86Implement Serializable with cautionRecords (Java 16+) with canonical constructor enforcement — safer for value types
Item 88Write readObject defensivelyRecords auto-invoke canonical constructor on deserialization — invariants enforced
Item 90Serialization proxy patternRecords 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–11equals and hashCode contracts (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 55Optional usage
  • 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 ?.

  1. Install the Spaced Repetition plugin in Obsidian.
  2. Open any *-flashcards.md file.
  3. Press the plugin’s “Review” button or use the command palette (Review flashcards in this file).
  4. Cards are automatically scheduled based on your recall quality.

Study Workflow

  1. First pass: Read the chapter notes (Overview + Items). Focus on “The Problem” and “The Solution.”
  2. Second pass: Work through the Interview Questions. Try to answer before reading the provided answer.
  3. Flashcard review: Review the chapter’s flashcard file. Rate cards honestly (again/hard/good/easy).
  4. 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.
  5. 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