Preparing for the Java 21 Cert and Learning New Features
summary
Java 21 adds virtual threads (lightweight, run on platform threads and scale to thousands), makes ExecutorService AutoCloseable so try-with-resources calls shutdown (not shutdownNow) and waits for tasks, and finalizes pattern matching: pattern matching for switch and record patterns (guarded cases, nested record deconstruction, switch expressions). Sequence collections give predictable order, UTF‑8 becomes default charset, StringBuilder.repeat and ranged indexOf appear, finalization is deprecated for removal, and javadoc gains code snippets. Certification for Java 21 is pending.
AI-written summary · about
