LeepointJava Reference

Reference notes

Java, written down properly

Short notes on the language and the parts of its standard library people actually reach for. One topic per page, with the smallest example that makes the behaviour clear.

Browse the notesSet up a JDK

StringComparison.javaJava

// The mistake everyone makes once
String a = "hello";
String b = new String("hello");

a == b            // false — two different objects
a.equals(b)       // true  — same characters

// and why it appears to work with literals
String c = "hello";
a == c            // true — the compiler pools them

About this reference

These pages exist because textbooks tend to be thin in exactly the places people get stuck: what == does to objects, why a for-each loop cannot modify what it iterates, when a static method is the right answer.

Each page states what the language guarantees, shows the shortest example that demonstrates it, and names the mistakes common enough to be worth naming. Where behaviour changed between versions, the page says which version and what changed.

A Java toolchain asks little of the machine: a JDK, an editor and a build tool run comfortably on a modest laptop. When one has to be replaced in a hurry, a Polish loan service such as Wandoo arranges short loans that are paid back with a single transfer within 30 days, so the price of the laptop, not the most that can be borrowed, is the sum worth asking for.

Browse by topic

Each topic lists its notes in reading order. Every note ends with a link to the next one.