1. 1. Prelude
    ❱
    1. 1.1. Asking for Help
    2. 1.2. Toy Problems
    3. 1.3. Lies
    4. 1.4. AI
    5. 1.5. Java
  2. 2. Getting Started
  3. 3. First Steps
    ❱
    1. 3.1. Comments
    2. 3.2. Semicolons
    3. 3.3. Formatting
    4. 3.4. Challenges
  4. 4. Local Variables
    ❱
    1. 4.1. Naming
    2. 4.2. Reassignment
    3. 4.3. Delayed Assignment
    4. 4.4. Types
    5. 4.5. Final Variables
    6. 4.6. Inferred Types
    7. 4.7. Challenges
  5. Data Types I
  6. 5. Booleans
    ❱
    1. 5.1. Not
    2. 5.2. And
    3. 5.3. Or
    4. 5.4. Operator Precedence
    5. 5.5. Challenges
  7. 6. Integers
    ❱
    1. 6.1. Integer Literals
    2. 6.2. Addition
    3. 6.3. Subtraction
    4. 6.4. Multiplication
    5. 6.5. Division
    6. 6.6. Remainder
    7. 6.7. Equality
    8. 6.8. Comparison
    9. 6.9. Chained Comparisons
    10. 6.10. Operator Precedence
    11. 6.11. Reassignment
    12. 6.12. Shorthands for Reassignment
    13. 6.13. Limits
    14. 6.14. Challenges
  8. 7. Floating Point Numbers
    ❱
    1. 7.1. Floating Point Literals
    2. 7.2. Accuracy
    3. 7.3. Addition
    4. 7.4. Subtraction
    5. 7.5. Multiplication
    6. 7.6. Division
    7. 7.7. Equality
    8. 7.8. Comparison
    9. 7.9. Shorthands for Reassignment
    10. 7.10. NaN
    11. 7.11. Positive and Negative Infinity
    12. 7.12. Square Root
    13. 7.13. Conversion to Integers
    14. 7.14. Conversion from Integers
    15. 7.15. Challenges
  9. 8. Characters
    ❱
    1. 8.1. Character Literals
    2. 8.2. Common Escape Sequences
    3. 8.3. Conversion to Integers
    4. 8.4. Conversion from Integers
    5. 8.5. Unicode
    6. 8.6. Challenges
  10. 9. Strings
    ❱
    1. 9.1. String Literals
    2. 9.2. Common Escape Sequences
    3. 9.3. The Empty String
    4. 9.4. Multiline String Literals
    5. 9.5. Concatenation
    6. 9.6. Equality
    7. 9.7. Length
    8. 9.8. Access Individual Characters
    9. 9.9. Challenges
  11. Interactive Programs
  12. 10. Standard Input
    ❱
    1. 10.1. Prompting
    2. 10.2. Interpreting Input
    3. 10.3. Integers
    4. 10.4. Floating Point Numbers
    5. 10.5. Other Types
    6. 10.6. Challenges
  13. Control Flow I
  14. 11. Branching Paths
    ❱
    1. 11.1. If
    2. 11.2. Nested Ifs
    3. 11.3. Else
    4. 11.4. Else If
    5. 11.5. Relation to Delayed Assignment
    6. 11.6. Scoped Variables
    7. 11.7. Conditional Operator
    8. 11.8. Boolean Expressions
    9. 11.9. Challenges
  15. 12. Loops
    ❱
    1. 12.1. While
    2. 12.2. Endless Loops
    3. 12.3. Break
    4. 12.4. Continue
    5. 12.5. Unreachable Code
    6. 12.6. Do While
    7. 12.7. Nested Loops
    8. 12.8. Labeled Break
    9. 12.9. Labeled Continue
    10. 12.10. Iteration
    11. 12.11. Counting Up
    12. 12.12. Counting Down
    13. 12.13. Iterate over a String
    14. 12.14. Challenges
  16. Projects
  17. 13. Prelude
  18. 14. Calorie Tracker
  19. Data Types II
  20. 15. Arrays
    ❱
    1. 15.1. Array Initializers
    2. 15.2. Length
    3. 15.3. Access Individual Elements
    4. 15.4. Set Individual Elements
    5. 15.5. Aliasing
    6. 15.6. Reassignment
    7. 15.7. Relation to Final Variables
    8. 15.8. Printing the Contents of an Array
    9. 15.9. Empty Array
    10. 15.10. Difference between Initializer and Literal
    11. 15.11. Initialization with new
    12. 15.12. Challenges
  21. Control Flow II
  22. 16. Loops II
    ❱
    1. 16.1. For
    2. 16.2. For Syntax
    3. 16.3. Counting Up and Down
    4. 16.4. Iterate over a String
    5. 16.5. Iterate over an Array
    6. 16.6. Comparison to while
    7. 16.7. i
    8. 16.8. Break
    9. 16.9. Continue
    10. 16.10. Delayed Assignment
    11. 16.11. Inferred Types
    12. 16.12. Empty Initializers
    13. 16.13. Empty Expressions
    14. 16.14. Empty Statements
    15. 16.15. Final Variables
    16. 16.16. Labeled Break
    17. 16.17. Labeled Continue
    18. 16.18. Drawing Right Triangles
    19. 16.19. Drawing Isosceles Triangles
    20. 16.20. Challenges
  23. Code Structure
  24. 17. Methods
    ❱
    1. 17.1. Declaration
    2. 17.2. Invocation
    3. 17.3. Scope
    4. 17.4. main
    5. 17.5. Challenges
  25. 18. Arguments
    ❱
    1. 18.1. Declaration
    2. 18.2. Invocation with Arguments
    3. 18.3. Reassignment
    4. 18.4. Final Arguments
    5. 18.5. Aliasing
    6. 18.6. Overloading
    7. 18.7. Inferred Types
    8. 18.8. Challenges
  26. 19. Return Values
    ❱
    1. 19.1. Declaration
    2. 19.2. Return Statement
    3. 19.3. Exhaustiveness
    4. 19.4. void
    5. 19.5. Return in void methods
    6. 19.6. Conversion
    7. 19.7. Unreachable Statements
    8. 19.8. Challenges
  27. Data Types III
  28. 20. Multi-Dimensional Arrays
    ❱
    1. 20.1. Declaration
    2. 20.2. Array Initializers
    3. 20.3. Initialization with new
    4. 20.4. Access Individual Elements
    5. 20.5. Set Individual Elements
    6. 20.6. Initialization with Size
    7. 20.7. Default Values
    8. 20.8. Populate Values
    9. 20.9. Ragged Arrays
    10. 20.10. Challenges
  29. Projects
  30. 21. ASCII Art Generator
  31. Data Types IV
  32. 22. null
    ❱
    1. 22.1. Null as Absence
    2. 22.2. Null as Unknown
    3. 22.3. Checking for null
    4. 22.4. NullPointerException
    5. 22.5. Challenges
  33. 23. Boxed Primitives
    ❱
    1. 23.1. Integer
    2. 23.2. Double
    3. 23.3. Character
    4. 23.4. Boolean
    5. 23.5. Unboxing Conversion
    6. 23.6. Boxing Conversion
    7. 23.7. Arrays of Boxed Primitives
    8. 23.8. Challenges
  34. 24. Arrays II
    ❱
    1. 24.1. Initializion with Size
    2. 24.2. Default Values
    3. 24.3. Populate Arrays
    4. 24.4. Challenges
  35. Code Structure II
  36. 25. Classes
    ❱
    1. 25.1. The meaning of the word Class
    2. 25.2. Class Declaration
    3. 25.3. Naming
    4. 25.4. Instances
    5. 25.5. Fields
    6. 25.6. Field Initialization
    7. 25.7. Field Access
    8. 25.8. Field Default Values
    9. 25.9. Aliasing
    10. 25.10. Return Multiple Values
    11. 25.11. Challenges
  37. 26. Instance Methods
    ❱
    1. 26.1. Invocation
    2. 26.2. Arguments
    3. 26.3. Field Access
    4. 26.4. Field Updates
    5. 26.5. Derived Values
    6. 26.6. Invoke Other Methods
    7. 26.7. this
    8. 26.8. Disambiguation
    9. 26.9. Clarity
    10. 26.10. Challenges
  38. Projects
  39. 27. Point of Sale System
  40. Data Types V
  41. 28. Enums
    ❱
    1. 28.1. Declaration
    2. 28.2. Variants
    3. 28.3. Naming
    4. 28.4. Usage
    5. 28.5. Equality
    6. 28.6. Comparison to boolean
    7. 28.7. Challenges
  42. 29. Strings II
    ❱
    1. 29.1. lowercase
    2. 29.2. UPPERCASE
    3. 29.3. Equality ignoring case
    4. 29.4. Check if empty
    5. 29.5. Check if blank
    6. 29.6. Strip extra whitespace
    7. 29.7. Challenges
  43. Control Flow III
  44. 30. Exceptions
    ❱
    1. 30.1. throw
    2. 30.2. Messages
    3. 30.3. Stack Traces
    4. 30.4. try/catch
    5. 30.5. Challenges
  45. 31. Switch
    ❱
    1. 31.1. Case and Default
    2. 31.2. Strings
    3. 31.3. ints
    4. 31.4. Enums
    5. 31.5. Omitted Default
    6. 31.6. Combining Cases
    7. 31.7. null
    8. 31.8. Exhaustiveness
    9. 31.9. Challenges
  46. Interactive Programs II
  47. 32. Standard Input II
    ❱
    1. 32.1. Reprompting
    2. 32.2. Enums
    3. 32.3. Delayed Assignment
    4. 32.4. Leniency
    5. 32.5. Aggregating Data
    6. 32.6. Challenges
  48. Code Structure III
  49. 33. Constructors
    ❱
    1. 33.1. Declaration
    2. 33.2. The Default Constructor
    3. 33.3. Arguments
    4. 33.4. Final Fields
    5. 33.5. Invariants
    6. 33.6. Overloads
    7. 33.7. Delegation
    8. 33.8. Challenges
  50. 34. Global Fields
    ❱
    1. 34.1. Default Values
    2. 34.2. Final Fields
    3. 34.3. Field Access
    4. 34.4. Inferred Types
    5. 34.5. Challenges
  51. Concepts
  52. 35. Code is Read more than Written
    ❱
    1. 35.1. Meaning
    2. 35.2. Implications
    3. 35.3. Information Density
    4. 35.4. Audience
    5. 35.5. Practice
  53. The Computing Environment
  54. 36. Hardware
    ❱
    1. 36.1. CPU
    2. 36.2. RAM
    3. 36.3. Hard Drives
    4. 36.4. Motherboard
  55. 37. Operating Systems
    ❱
    1. 37.1. Personal Computers
    2. 37.2. Servers
    3. 37.3. Mobile Phones
    4. 37.4. Game Consoles
    5. 37.5. Abstractions
    6. 37.6. Defaults
  56. 38. The Terminal
    ❱
    1. 38.1. Bash
    2. 38.2. Windows Subsystem for Linux
    3. 38.3. Chromebooks and School Computers
    4. 38.4. Commands
    5. 38.5. Directories
    6. 38.6. Listing Files
    7. 38.7. Creating Directories
    8. 38.8. Changing Directories
    9. 38.9. Creating Files
    10. 38.10. Run Java Programs
    11. 38.11. Getting Used to it
  57. Control Flow IV
  58. 39. Exceptions II
    ❱
    1. 39.1. Checked Exceptions
    2. 39.2. Unchecked Exceptions
    3. 39.3. throws
    4. 39.4. Propagating Exceptions
    5. 39.5. Exception
    6. 39.6. RuntimeException
    7. 39.7. Rethrowing Exceptions
    8. 39.8. main
    9. 39.9. Challenges
  59. 40. Switch II
    ❱
    1. 40.1. Yield
    2. 40.2. Omitted Yield
    3. 40.3. Exhaustiveness
    4. 40.4. Return a Switch
    5. 40.5. Challenges
  60. Code Structure IV
  61. 41. Multi-File Programs
    ❱
    1. 41.1. The Sources folder
    2. 41.2. The Main file
    3. 41.3. A Second file
    4. 41.4. File names
    5. 41.5. The Anonymous Main Class
    6. 41.6. Global Fields
    7. 41.7. Challenges
  62. 42. Visibility
    ❱
    1. 42.1. Private Methods
    2. 42.2. Private Fields
    3. 42.3. Invariants
    4. 42.4. Accessors
    5. 42.5. Getters and Setters
    6. 42.6. Challenges
  63. 43. Static Fields
    ❱
    1. 43.1. Declaration
    2. 43.2. Initialization
    3. 43.3. Usage
    4. 43.4. Constants
    5. 43.5. Controversy
    6. 43.6. Naming
    7. 43.7. Challenges
  64. 44. Static Methods
    ❱
    1. 44.1. Declaration
    2. 44.2. Scope
    3. 44.3. Naming
    4. 44.4. Usage
    5. 44.5. Math
    6. 44.6. Factories
    7. 44.7. Challenges
  65. Data Structures & Algorithms
  66. 45. Growable Arrays
    ❱
    1. 45.1. Concept
    2. 45.2. Simple Implementation
    3. 45.3. Usage
    4. 45.4. Performance Problems
    5. 45.5. Performance Solutions
    6. 45.6. Optimized Implementation
    7. 45.7. Challenges
  67. Interactive Programs II
  68. 46. Command Line Arguments
    ❱
    1. 46.1. Accessing Arguments
    2. 46.2. Conventions
    3. 46.3. Challenges
  69. Code Structure V
  70. 47. Inner Classes
    ❱
    1. 47.1. Type
    2. 47.2. Instances
    3. 47.3. New Operator
    4. 47.4. Scope
    5. 47.5. Disambiguation
    6. 47.6. The anonymous main class
    7. 47.7. Static Inner Classes
    8. 47.8. Private Inner Classes
    9. 47.9. Challenges
  71. 48. Packages
    ❱
    1. 48.1. Declaration
    2. 48.2. Visibility
    3. 48.3. Public Classes
    4. 48.4. Fully Qualified Class Name
    5. 48.5. Import
    6. 48.6. The Default Package
    7. 48.7. The Anonymous Main Class
    8. 48.8. Public Methods
    9. 48.9. Package-Private Methods
    10. 48.10. Public Fields
    11. 48.11. Package-Private Fields
    12. 48.12. The Default Constructor
    13. 48.13. Public Constructors
    14. 48.14. Package-Private Constructors
    15. 48.15. Subpackages
    16. 48.16. Reverse Domain Name Notation
    17. 48.17. Challenges
  72. Data Types VI
  73. 49. Records
    ❱
    1. 49.1. Declaration
    2. 49.2. The Canonical Constructor
    3. 49.3. Component Accessors
    4. 49.4. Component Accessor Visibility
    5. 49.5. Printing a Record
    6. 49.6. Check for Equality
    7. 49.7. Return Multiple Values
    8. 49.8. Shorthand
    9. 49.9. Challenges
  74. 50. Integers II
    ❱
    1. 50.1. Integer from a String
    2. 50.2. Integer to a String
    3. 50.3. Base 16 Integer Literals
    4. 50.4. Integer from a Base 16 String
    5. 50.5. Integer to a Base 16 String
    6. 50.6. Underscores in Integer Literals
    7. 50.7. Challenges
  75. Interactive Programs III
  76. 51. Files
    ❱
    1. 51.1. Paths
    2. 51.2. IOException
    3. 51.3. UncheckedIOException
    4. 51.4. Write to a File
    5. 51.5. Read from a File
    6. 51.6. Create a Folder
    7. 51.7. Challenges
  77. Projects
  78. 52. Data Visualization
  79. Code Structure VI
  80. 53. Object
    ❱
    1. 53.1. Subtypes
    2. 53.2. instanceof
    3. 53.3. toString
    4. 53.4. Override toString
    5. 53.5. @Override
    6. 53.6. equals and hashCode
    7. 53.7. Override equals and hashCode
    8. 53.8. Challenges
  81. 54. Generics
    ❱
    1. 54.1. Type Variables
    2. 54.2. Naming
    3. 54.3. Instantiation
    4. 54.4. Inference
    5. 54.5. Soundness
    6. 54.6. Raw Types
    7. 54.7. Challenges
  82. 55. Interfaces
    ❱
    1. 55.1. Interface Declaration
    2. 55.2. Implementation
    3. 55.3. @Override
    4. 55.4. Naming
    5. 55.5. Subtypes
    6. 55.6. Multiple Implementations
    7. 55.7. Challenges
  83. Data Types VII
  84. 56. Time
    ❱
    1. 56.1. Instant
    2. 56.2. Duration
    3. 56.3. LocalDate
    4. 56.4. LocalTime
    5. 56.5. LocalDateTime
    6. 56.6. Time Zones
    7. 56.7. ZonedDateTime
    8. 56.8. OffsetDateTime
    9. 56.9. Date
    10. 56.10. Challenges
  85. 57. ArrayList
    ❱
    1. 57.1. Ubiquity
    2. 57.2. Add an item
    3. 57.3. Size
    4. 57.4. Get an item
    5. 57.5. Loop over items
    6. 57.6. Set an item
    7. 57.7. Remove an item
    8. 57.8. Challenges
  86. 58. HashMap
    ❱
    1. 58.1. Filing Cabinets
    2. 58.2. Keys and Values
    3. 58.3. Put Items
    4. 58.4. Get Items
    5. 58.5. Hash Functions
    6. 58.6. Hash Collision
    7. 58.7. Hash Distribution
    8. 58.8. Reference Based Identity
    9. 58.9. Value Based Identity
    10. 58.10. Appropriate Keys
    11. 58.11. Ubiquity
    12. 58.12. Challenges
  87. Concepts II
  88. 59. Hyrum's Law
    ❱
    1. 59.1. Authority
    2. 59.2. Validity
    3. 59.3. Emergent Properties
    4. 59.4. Importance
  89. Control Flow V
  90. 60. Switch III
    ❱
    1. 60.1. break
    2. 60.2. fallthrough
    3. 60.3. return
    4. 60.4. default
    5. 60.5. yield
    6. 60.6. Challenges
  91. 61. Recursion
    ❱
    1. 61.1. Disclaimer
    2. 61.2. Base Case
    3. 61.3. Comparison to Delegation
    4. 61.4. Comparison to Loops
    5. 61.5. Counting Down
    6. 61.6. Accumulators
    7. 61.7. Recurse Over a String
    8. 61.8. Recurse Over an Array
    9. 61.9. Challenges
  92. 62. Loops III
    ❱
    1. 62.1. For-each loops
    2. 62.2. Arrays
    3. 62.3. Iterable and Iterator
    4. 62.4. ArrayList
    5. 62.5. String
    6. 62.6. Concurrent Modifications
    7. 62.7. Inferred Types
    8. 62.8. Challenges
  93. Concepts II
  94. 63. Encapsulation
    ❱
    1. 63.1. Implementation Details
    2. 63.2. Implicit Interfaces
    3. 63.3. Methods
    4. 63.4. Classes
    5. 63.5. Abstraction
    6. 63.6. Coupling
    7. 63.7. Leaky Abstractions
    8. 63.8. Information Hiding
  95. Data Types VIII
  96. 64. Collections
    ❱
    1. 64.1. List
    2. 64.2. Map
    3. 64.3. Set
    4. 64.4. Arrays
    5. 64.5. UnsupportedOperationException
    6. 64.6. Factories
    7. 64.7. Specificity
    8. 64.8. Challenges
  97. Metaprogramming
  98. 65. Reflection
    ❱
    1. 65.1. Class Objects
    2. 65.2. Get all Fields
    3. 65.3. Get a Field
    4. 65.4. Read from a Field
    5. 65.5. Write to a Field
    6. 65.6. Get all Methods
    7. 65.7. Get a Method
    8. 65.8. Invoke a Method
    9. 65.9. Get a Constructor
    10. 65.10. Get all Constructors
    11. 65.11. Invoke a Constructor
    12. 65.12. Challenges
  99. 66. Annotations
    ❱
    1. 66.1. Declaration
    2. 66.2. Usage
    3. 66.3. Elements
    4. 66.4. Usage with Elements
    5. 66.5. Defaults
    6. 66.6. @Target
    7. 66.7. @Retention
    8. 66.8. Reflective Access
    9. 66.9. @Override
    10. 66.10. Challenges
  100. Code Structure VII
  101. 67. Interfaces II
    ❱
    1. 67.1. Default Methods
    2. 67.2. Interface Extension
    3. 67.3. Static Methods
    4. 67.4. Static Fields
    5. 67.5. Challenges
  102. 68. Class Extension
    ❱
    1. 68.1. Extend a Class
    2. 68.2. Inheritance
    3. 68.3. Override
    4. 68.4. Protected
    5. 68.5. Abstract Classes
    6. 68.6. Abstract Methods
    7. 68.7. Relation to Interfaces
    8. 68.8. Relation to Encapsulation
    9. 68.9. Final Classes
    10. 68.10. Challenges
  103. Data Types IX
  104. 69. Niche Numerics
    ❱
    1. 69.1. byte
    2. 69.2. short
    3. 69.3. long
    4. 69.4. Unsigned Operations
    5. 69.5. float
    6. 69.6. Challenges
  105. Projects
  106. 70. Hot Cross Buns
  107. Code Structure VIII
  108. 71. Modules
    ❱
    1. 71.1. Declaration
    2. 71.2. Restrictions
    3. 71.3. Exports
    4. 71.4. Integrity
    5. 71.5. java.base
    6. 71.6. The Unnamed Module
    7. 71.7. Module Imports
    8. 71.8. Multi-Module Directory Layout
  109. 72. Lambdas
    ❱
    1. 72.1. Functional Interfaces
    2. 72.2. @FunctionalInterface
    3. 72.3. Lambda Expressions
    4. 72.4. Method References
    5. 72.5. Runnable
    6. 72.6. Function
    7. 72.7. Relation to Checked Exceptions
  110. 73. Streams
    ❱
    1. 73.1. map
    2. 73.2. filter
    3. 73.3. Collectors
    4. 73.4. toList
    5. 73.5. mapMulti
    6. 73.6. Gatherers
  111. Sharing Code
  112. 74. Compilation
    ❱
    1. 74.1. javac
    2. 74.2. Class Files
    3. 74.3. Modules
    4. 74.4. Compile Multiple Files
    5. 74.5. Clean
    6. 74.6. -g
    7. 74.7. Running Compiled Code
    8. 74.8. Challenges
  113. 75. Packaging
    ❱
    1. 75.1. jar
    2. 75.2. Jar Files
    3. 75.3. --module-path
    4. 75.4. --main-class
    5. 75.5. Libraries
    6. 75.6. Challenges
  114. Tools
  115. 76. just
    ❱
    1. 76.1. Installation
    2. 76.2. Justfile
    3. 76.3. Recipes
    4. 76.4. Dependencies
    5. 76.5. Documentation Comments
    6. 76.6. Further Reading
    7. 76.7. Challenges
  116. Sharing Code II
  117. 77. Documentation
    ❱
    1. 77.1. Documentation Comments
    2. 77.2. Format
    3. 77.3. javadoc
    4. 77.4. Challenges
  118. 78. 🚧 (More Chapters Planned) 🚧

Modern Java

map