What changed in Java 9
4 changes across 3 questions — each with the behaviour it replaced, because “and how did it work before?” is the follow-up.
When would you use LinkedList instead of ArrayList?
List.of() returns a genuinely immutable list that rejects nulls and refuses every mutator.
Before: Arrays.asList() gave you a fixed-size list that still wrote through to the backing array, and Collections.unmodifiableList() gave you a view whose source could still change underneath you.
Why is String immutable, and what is the string pool?
Compact Strings: the backing array became a byte[] plus a one-byte coder, storing Latin-1 text at one byte per character.
Before (now gone): The backing array was always char[] — two bytes per character, so ASCII text cost double for nothing. Strings are typically the largest single category of live objects in a heap, so this was among the largest free wins in JVM history.
String concatenation with + compiles to invokedynamic makeConcatWithConstants, letting the JVM build the result in one pass at runtime (JEP 280).
Before (now gone): javac emitted an explicit StringBuilder chain: new StringBuilder().append(..).append(..).toString(). That is why 'the compiler rewrites + into StringBuilder' is now a decade out of date.
What is the difference between checked and unchecked exceptions?
try-with-resources accepts an existing effectively-final variable, so you can write try (conn) { }.
Before: You had to redeclare the resource inside the parentheses, even when you already held it.