Earlier quoted context omitted.
> but I do admire Java for making it significantly more painful to write mutable rather than immutable classes; Out of curiosity, how does it do that? As far as I know, everything in Java is mutable by default.
You have to go through the extra ceremony of writing a setter.
class Foo {
private int x = 0;
public void bar() {
this.x += 1; // Whoops!
}
}
Foo x = new Foo();
x.bar(); // Mutating call.
Which Java does not prevent.