Skip to content
Lukas Grigis
All guides

Java Foundations: the primitives, runnable

Reference articles for the Java primitives, each explained and backed by a runnable brick: data modeling, then the memory model.

Field guide2 articles, 20 min

These are the reference articles for the Java primitives. Every article pairs with one runnable brick in the java-foundations (opens in a new tab) repo, and one command runs it. Where an article measures something, the number comes from that brick's recorded runs, with the machine named.

The list below is in publication order, and it's the only order there is. Each article carries one rule you can keep in your head, and the key ideas under the list collect them, one per article. More parts join as the bricks get written up.

In this guide, in reading order

Run the code

Key ideas

  • Next time you reach for a record, ask whether it's actually one alternative of a closed set. If it is, seal the set and delete the default branch.
  • One writer: volatile. New value from the old one: atomic. More than one line: synchronized.