Skip to content

Topic 4: Abstraction, Interfaces, Generics & Nested Classes

Mastering Java's abstraction mechanisms — from abstract classes and interfaces to generics, comparators, and nested class types.


Topic Structure

Document Purpose Status
Part 1 — Abstract Classes Abstraction, generalization, abstract classes, multi-level hierarchies, Store challenge Complete
Part 2 — Interfaces & Challenge Interface contracts, multiple implementations, default/static/private methods, interface vs abstract, Mappable challenge Complete
Part 3 — Generics: Classes & Bounds Generics fundamentals, type parameters, raw types, upper bounds, Layer challenge Complete
Part 4 — Generics: Comparable, Wildcards & Erasure Comparable, Comparator, wildcards, type erasure, advanced techniques Complete
Part 5 — Nested Classes Static Nested, Inner, Local, and Anonymous classes Complete
Book Reading Effective Java insights Complete
Summary Combined final understanding Complete

What You'll Master

  • Abstract Classes — Abstract methods, concrete methods, when to use abstract vs interface
  • Interfaces — Default methods, static methods, multiple inheritance of type
  • Polymorphism (Advanced) — Expanding polymorphism with interfaces and hierarchies
  • Java Generics — Type parameters, bounded types, wildcards (?, ? extends T, ? super T)
  • ComparatorsComparable vs Comparator, sorting with custom logic
  • Type Erasure — How generics work at runtime and its implications
  • Nested Classes — Static nested classes, inner classes, local classes, anonymous classes

Resources

Primary Course

Book Reference

  • Effective Java by Joshua Bloch — Items 26–33 (Generics), Items 18–25 (Interfaces)

Course Sections Covered

Section Title Part
Section 11 (Lectures 1–7) Abstract Classes Part 1
Section 11 (Lectures 8–16) Interfaces & Interface Challenge Part 2
Section 12 (Lectures 1–6) Generics: Classes, Bounds & Layer Challenge Part 3
Section 12 (Lectures 7–12) Generics: Comparable, Comparator, Wildcards & Type Erasure Part 4
Section 13 Exploring Nested Classes, Local Types & Anonymous Classes Part 5

Key Internals to Understand

  • Difference between arrays (covariant) and generics (invariant)
  • Type erasure mechanism and its implications
  • Raw types vs parameterized types
  • PECS principle (Producer Extends, Consumer Super)
  • When to use abstract classes vs interfaces
  • Nested class scope and access rules

Progress Tracker

  • Write Part 1 topic notes (Abstract Classes, Lectures 1–7)
  • Write Part 2 topic notes (Interfaces & Challenge, Lectures 8–16)
  • Write Part 3 topic notes (Generics: Classes & Bounds, Lectures 1–6)
  • Write Part 4 topic notes (Generics: Comparable, Wildcards & Erasure, Lectures 7–12)
  • Write Part 5 topic notes (Nested Classes, Section 13)
  • Read Effective Java related items
  • Complete book reading notes
  • Synthesize final summary

Last Updated: 2026-02-25