1.
Prelude
❱
1.1.
Asking for Help
1.2.
Toy Problems
1.3.
Lies
1.4.
AI
1.5.
Java
1.6.
Testimonials
Modern Java
2.
Set Up Your Computer
❱
2.1.
Text Editors
2.2.
IDEs
2.3.
VSCodium
2.4.
Install VSCodium
2.5.
Install Java
3.
The Terminal
❱
3.1.
Bash
3.2.
Windows Subsystem for Linux
3.3.
Chromebooks and School Computers
3.4.
Commands
3.5.
Directories
3.6.
Listing Files
3.7.
Creating Directories
3.8.
Changing Directories
3.9.
Creating Files
3.10.
Run Java Programs
3.11.
Getting Used to it
4.
First Steps
❱
4.1.
Comments
4.2.
Semicolons
4.3.
Formatting
4.4.
Challenges
5.
Local Variables
❱
5.1.
Naming
5.2.
Reassignment
5.3.
Delayed Assignment
5.4.
Types
5.5.
Final Variables
5.6.
Inferred Types
5.7.
Challenges
Data Types I
6.
Booleans
❱
6.1.
Not
6.2.
And
6.3.
Or
6.4.
Operator Precedence
6.5.
Challenges
7.
Integers
❱
7.1.
Integer Literals
7.2.
Addition
7.3.
Subtraction
7.4.
Multiplication
7.5.
Division
7.6.
Remainder
7.7.
Equality
7.8.
Comparison
7.9.
Chained Comparisons
7.10.
Operator Precedence
7.11.
Reassignment
7.12.
Shorthands for Reassignment
7.13.
Limits
7.14.
Challenges
8.
Floating Point Numbers
❱
8.1.
Floating Point Literals
8.2.
Accuracy
8.3.
Addition
8.4.
Subtraction
8.5.
Multiplication
8.6.
Division
8.7.
Equality
8.8.
Comparison
8.9.
Shorthands for Reassignment
8.10.
NaN
8.11.
Positive and Negative Infinity
8.12.
Square Root
8.13.
Conversion to Integers
8.14.
Conversion from Integers
8.15.
Challenges
9.
Characters
❱
9.1.
Character Literals
9.2.
Common Escape Sequences
9.3.
Conversion to Integers
9.4.
Conversion from Integers
9.5.
Unicode
9.6.
Challenges
10.
Strings
❱
10.1.
String Literals
10.2.
Common Escape Sequences
10.3.
The Empty String
10.4.
Multiline String Literals
10.5.
Concatenation
10.6.
Equality
10.7.
Length
10.8.
Access Individual Characters
10.9.
Challenges
Interactive Programs
11.
Standard Input
❱
11.1.
Prompting
11.2.
Interpreting Input
11.3.
Integers
11.4.
Floating Point Numbers
11.5.
Other Types
11.6.
Challenges
Control Flow I
12.
Branching Paths
❱
12.1.
If
12.2.
Nested Ifs
12.3.
Else
12.4.
Else If
12.5.
Relation to Delayed Assignment
12.6.
Scoped Variables
12.7.
Conditional Operator
12.8.
Boolean Expressions
12.9.
Challenges
13.
Loops
❱
13.1.
While
13.2.
Endless Loops
13.3.
Break
13.4.
Continue
13.5.
Unreachable Code
13.6.
Do While
13.7.
Nested Loops
13.8.
Labeled Break
13.9.
Labeled Continue
13.10.
Iteration
13.11.
Counting Up
13.12.
Counting Down
13.13.
Iterate over a String
13.14.
Challenges
Projects
14.
Prelude
15.
Calorie Tracker
Data Types II
16.
Arrays
❱
16.1.
Array Initializers
16.2.
Length
16.3.
Access Individual Elements
16.4.
Set Individual Elements
16.5.
Aliasing
16.6.
Reassignment
16.7.
Relation to Final Variables
16.8.
Printing the Contents of an Array
16.9.
Empty Array
16.10.
Difference between Initializer and Literal
16.11.
Initialization with new
16.12.
Challenges
Control Flow II
17.
Loops II
❱
17.1.
For
17.2.
For Syntax
17.3.
Counting Up and Down
17.4.
Iterate over a String
17.5.
Iterate over an Array
17.6.
Comparison to while
17.7.
i
17.8.
Break
17.9.
Continue
17.10.
Delayed Assignment
17.11.
Inferred Types
17.12.
Empty Initializers
17.13.
Empty Expressions
17.14.
Empty Statements
17.15.
Final Variables
17.16.
Labeled Break
17.17.
Labeled Continue
17.18.
Drawing Right Triangles
17.19.
Drawing Isosceles Triangles
17.20.
Challenges
Code Structure
18.
Methods
❱
18.1.
Declaration
18.2.
Invocation
18.3.
Scope
18.4.
main
18.5.
Challenges
19.
Arguments
❱
19.1.
Declaration
19.2.
Invocation with Arguments
19.3.
Reassignment
19.4.
Final Arguments
19.5.
Aliasing
19.6.
Overloading
19.7.
Inferred Types
19.8.
Challenges
20.
Return Values
❱
20.1.
Declaration
20.2.
Return Statement
20.3.
Exhaustiveness
20.4.
void
20.5.
Return in void methods
20.6.
Conversion
20.7.
Unreachable Statements
20.8.
Challenges
Data Types III
21.
Multi-Dimensional Arrays
❱
21.1.
Declaration
21.2.
Array Initializers
21.3.
Initialization with new
21.4.
Access Individual Elements
21.5.
Set Individual Elements
21.6.
Initialization with Size
21.7.
Default Values
21.8.
Populate Values
21.9.
Ragged Arrays
21.10.
Challenges
Projects
22.
ASCII Art Generator
Data Types IV
23.
null
❱
23.1.
Null as Absence
23.2.
Null as Unknown
23.3.
Checking for null
23.4.
NullPointerException
23.5.
Challenges
24.
Boxed Primitives
❱
24.1.
Integer
24.2.
Double
24.3.
Character
24.4.
Boolean
24.5.
Unboxing Conversion
24.6.
Boxing Conversion
24.7.
Arrays of Boxed Primitives
24.8.
Challenges
25.
Arrays II
❱
25.1.
Initializion with Size
25.2.
Default Values
25.3.
Populate Arrays
25.4.
Challenges
Code Structure II
26.
Classes
❱
26.1.
The meaning of the word Class
26.2.
Class Declaration
26.3.
Naming
26.4.
Instances
26.5.
Fields
26.6.
Field Initialization
26.7.
Field Access
26.8.
Field Default Values
26.9.
Multiple Instances
26.10.
Aliasing
26.11.
Return Multiple Values
26.12.
Challenges
27.
Instance Methods
❱
27.1.
Invocation
27.2.
Arguments
27.3.
Field Access
27.4.
Field Updates
27.5.
Derived Values
27.6.
Invoke Other Methods
27.7.
this
27.8.
Disambiguation
27.9.
Clarity
27.10.
Challenges
Projects
28.
Point of Sale System
Data Types V
29.
Enums
❱
29.1.
Declaration
29.2.
Variants
29.3.
Naming
29.4.
Usage
29.5.
Equality
29.6.
Comparison to boolean
29.7.
Challenges
30.
Strings II
❱
30.1.
lowercase
30.2.
UPPERCASE
30.3.
Equality ignoring case
30.4.
Check if empty
30.5.
Check if blank
30.6.
Strip extra whitespace
30.7.
Challenges
Control Flow III
31.
Exceptions
❱
31.1.
throw
31.2.
Messages
31.3.
Stack Traces
31.4.
try/catch
31.5.
Challenges
32.
Switch
❱
32.1.
Case and Default
32.2.
Strings
32.3.
ints
32.4.
Enums
32.5.
Omitted Default
32.6.
Combining Cases
32.7.
null
32.8.
Exhaustiveness
32.9.
Challenges
Interactive Programs II
33.
Standard Input II
❱
33.1.
Reprompting
33.2.
Enums
33.3.
Delayed Assignment
33.4.
Leniency
33.5.
Aggregating Data
33.6.
Challenges
Code Structure III
34.
Constructors
❱
34.1.
Declaration
34.2.
The Default Constructor
34.3.
Arguments
34.4.
Final Fields
34.5.
Invariants
34.6.
Overloads
34.7.
Delegation
34.8.
Challenges
35.
Global Fields
❱
35.1.
Default Values
35.2.
Final Fields
35.3.
Field Access
35.4.
Inferred Types
35.5.
Challenges
Projects
36.
Tic-Tac-Toe
Concepts
37.
Code is Read more than Written
❱
37.1.
Meaning
37.2.
Implications
37.3.
Information Density
37.4.
Audience
37.5.
Practice
Control Flow IV
38.
Exceptions II
❱
38.1.
Checked Exceptions
38.2.
Unchecked Exceptions
38.3.
throws
38.4.
Propagating Exceptions
38.5.
Exception
38.6.
RuntimeException
38.7.
Rethrowing Exceptions
38.8.
main
38.9.
Challenges
39.
Switch II
❱
39.1.
Yield
39.2.
Omitted Yield
39.3.
Exhaustiveness
39.4.
Return a Switch
39.5.
Challenges
Code Structure IV
40.
Multi-File Programs
❱
40.1.
The Sources folder
40.2.
The Main file
40.3.
A Second file
40.4.
File names
40.5.
The Anonymous Main Class
40.6.
Global Fields
40.7.
Challenges
41.
Visibility
❱
41.1.
Private Methods
41.2.
Private Fields
41.3.
Invariants
41.4.
Accessors
41.5.
Getters and Setters
41.6.
Challenges
42.
Static Fields
❱
42.1.
Declaration
42.2.
Initialization
42.3.
Usage
42.4.
Constants
42.5.
Controversy
42.6.
Naming
42.7.
Challenges
43.
Static Methods
❱
43.1.
Declaration
43.2.
Scope
43.3.
Naming
43.4.
Usage
43.5.
Math
43.6.
Factories
43.7.
Challenges
Data Structures & Algorithms
44.
Growable Arrays
❱
44.1.
Concept
44.2.
Simple Implementation
44.3.
Usage
44.4.
Performance Problems
44.5.
Performance Solutions
44.6.
Optimized Implementation
44.7.
Challenges
Interactive Programs III
45.
Command Line Arguments
❱
45.1.
Accessing Arguments
45.2.
Conventions
45.3.
Challenges
Code Structure V
46.
Inner Classes
❱
46.1.
Type
46.2.
Instances
46.3.
New Operator
46.4.
Scope
46.5.
Disambiguation
46.6.
The anonymous main class
46.7.
Static Inner Classes
46.8.
Private Inner Classes
46.9.
Challenges
47.
Packages
❱
47.1.
Declaration
47.2.
Visibility
47.3.
Public Classes
47.4.
Fully Qualified Class Name
47.5.
Import
47.6.
Package Imports
47.7.
The Default Package
47.8.
The Anonymous Main Class
47.9.
Public Methods
47.10.
Package-Private Methods
47.11.
Public Fields
47.12.
Package-Private Fields
47.13.
The Default Constructor
47.14.
Public Constructors
47.15.
Package-Private Constructors
47.16.
Subpackages
47.17.
Reverse Domain Name Notation
47.18.
Challenges
Data Types VI
48.
Records
❱
48.1.
Declaration
48.2.
The Canonical Constructor
48.3.
Component Accessors
48.4.
Component Accessor Visibility
48.5.
Printing a Record
48.6.
Check for Equality
48.7.
Return Multiple Values
48.8.
Shorthand
48.9.
Challenges
49.
Integers II
❱
49.1.
Integer from a String
49.2.
Integer to a String
49.3.
Base 16 Integer Literals
49.4.
Integer from a Base 16 String
49.5.
Integer to a Base 16 String
49.6.
Underscores in Integer Literals
49.7.
Challenges
Interactive Programs IV
50.
Files
❱
50.1.
Paths
50.2.
IOException
50.3.
UncheckedIOException
50.4.
Write to a File
50.5.
Read from a File
50.6.
Create a Folder
50.7.
Challenges
Projects
51.
Data Visualization
Code Structure VI
52.
Object
❱
52.1.
Subtypes
52.2.
instanceof
52.3.
toString
52.4.
Override toString
52.5.
@Override
52.6.
equals and hashCode
52.7.
Override equals and hashCode
52.8.
Challenges
53.
Generics
❱
53.1.
Type Variables
53.2.
Naming
53.3.
Instantiation
53.4.
Inference
53.5.
Soundness
53.6.
Raw Types
53.7.
Challenges
54.
Interfaces
❱
54.1.
Interface Declaration
54.2.
Implementation
54.3.
@Override
54.4.
Naming
54.5.
Subtypes
54.6.
Multiple Implementations
54.7.
Challenges
Data Types VII
55.
Time
❱
55.1.
Instant
55.2.
Duration
55.3.
LocalDate
55.4.
LocalTime
55.5.
LocalDateTime
55.6.
Time Zones
55.7.
ZonedDateTime
55.8.
OffsetDateTime
55.9.
Date
55.10.
Challenges
56.
ArrayList
❱
56.1.
Ubiquity
56.2.
Add an item
56.3.
Size
56.4.
Get an item
56.5.
Loop over items
56.6.
Set an item
56.7.
Remove an item
56.8.
Challenges
57.
HashMap
❱
57.1.
Filing Cabinets
57.2.
Keys and Values
57.3.
Put Items
57.4.
Get Items
57.5.
Hash Functions
57.6.
Hash Collision
57.7.
Hash Distribution
57.8.
Reference Based Identity
57.9.
Value Based Identity
57.10.
Appropriate Keys
57.11.
Ubiquity
57.12.
Challenges
Concepts II
58.
Hyrum's Law
❱
58.1.
Authority
58.2.
Validity
58.3.
Emergent Properties
58.4.
Importance
Control Flow V
59.
Switch III
❱
59.1.
break
59.2.
fallthrough
59.3.
return
59.4.
default
59.5.
yield
59.6.
Challenges
60.
Recursion
❱
60.1.
Disclaimer
60.2.
Base Case
60.3.
Comparison to Delegation
60.4.
Comparison to Loops
60.5.
Counting Down
60.6.
Accumulators
60.7.
Recurse Over a String
60.8.
Recurse Over an Array
60.9.
Challenges
61.
Loops III
❱
61.1.
For-each loops
61.2.
Arrays
61.3.
Iterable and Iterator
61.4.
ArrayList
61.5.
String
61.6.
Concurrent Modifications
61.7.
Inferred Types
61.8.
Challenges
Concepts III
62.
Encapsulation
❱
62.1.
Implementation Details
62.2.
Implicit Interfaces
62.3.
Methods
62.4.
Classes
62.5.
Abstraction
62.6.
Coupling
62.7.
Leaky Abstractions
62.8.
Information Hiding
Data Types VIII
63.
Collections
❱
63.1.
List
63.2.
Map
63.3.
Set
63.4.
Arrays
63.5.
UnsupportedOperationException
63.6.
Factories
63.7.
Specificity
63.8.
Challenges
Metaprogramming
64.
Reflection
❱
64.1.
Class Objects
64.2.
Get all Fields
64.3.
Get a Field
64.4.
Read from a Field
64.5.
Write to a Field
64.6.
Get all Methods
64.7.
Get a Method
64.8.
Invoke a Method
64.9.
Get a Constructor
64.10.
Get all Constructors
64.11.
Invoke a Constructor
64.12.
Challenges
65.
Annotations
❱
65.1.
Declaration
65.2.
Usage
65.3.
Elements
65.4.
Usage with Elements
65.5.
Defaults
65.6.
@Target
65.7.
@Retention
65.8.
Reflective Access
65.9.
@Override
65.10.
Challenges
Code Structure VII
66.
Interfaces II
❱
66.1.
Default Methods
66.2.
Interface Extension
66.3.
Static Methods
66.4.
Static Fields
66.5.
Challenges
67.
Class Extension
❱
67.1.
Extend a Class
67.2.
Inheritance
67.3.
Override
67.4.
Protected
67.5.
Abstract Classes
67.6.
Abstract Methods
67.7.
Relation to Interfaces
67.8.
Relation to Encapsulation
67.9.
Final Classes
67.10.
Challenges
Data Types IX
68.
Niche Numerics
❱
68.1.
byte
68.2.
short
68.3.
long
68.4.
Unsigned Operations
68.5.
float
68.6.
Challenges
Projects
69.
Music Maker
Code Structure VIII
70.
Modules
❱
70.1.
Declaration
70.2.
Restrictions
70.3.
Exports
70.4.
Requires
70.5.
Module Imports
70.6.
java.base
70.7.
The Unnamed Module
70.8.
Multi-Module Directory Layout
70.9.
Purpose
70.10.
Challenges
71.
Lambdas
❱
71.1.
Functional Interfaces
71.2.
@FunctionalInterface
71.3.
Lambda Expressions
71.4.
Arguments
71.5.
Return
71.6.
Method References
71.7.
Constructor References
71.8.
Inference
71.9.
Built-In Functional Interfaces
71.10.
Checked Exceptions
71.11.
Challenges
Sharing Code
72.
Compilation
❱
72.1.
javac
72.2.
Class Files
72.3.
Modules
72.4.
Compile Multiple Files
72.5.
Clean
72.6.
-g
72.7.
Running Compiled Code
72.8.
Challenges
73.
Packaging
❱
73.1.
jar
73.2.
Jar Files
73.3.
--module-path
73.4.
--main-class
73.5.
Libraries
73.6.
Challenges
Tools
74.
just
❱
74.1.
Installation
74.2.
Justfile
74.3.
Recipes
74.4.
Dependencies
74.5.
Documentation Comments
74.6.
Further Reading
74.7.
Challenges
Sharing Code II
75.
Documentation
❱
75.1.
Documentation Comments
75.2.
Format
75.3.
javadoc
75.4.
Challenges
Data Types X
76.
Streams
❱
76.1.
stream
76.2.
map
76.3.
filter
76.4.
Terminal Operations
76.5.
Collectors
76.6.
Purpose
76.7.
Challenges
Conclusion
77.
What Now?
78.
🚧 (More Chapters Planned) 🚧
Light
Rust
Coal
Navy
Ayu
Modern Java
Testimonials