Java

Every article filed under Java.

·7 min read

Java Multithreading Interview Questions, Answered by Running Them

Six questions from every Java concurrency interview, answered with a program's output rather than a definition — starting with how much a race really loses.

Java
·5 min read

Java Optional: The Methods Worth Knowing, and the One That Fools Everyone

Optional's useful methods with real output — and a measurement showing orElse runs its fallback even when the value is present, while orElseGet does not.

Java
·5 min read

Java Stream API Examples, and Four Ways They Surprise You

Complete stream examples with real output — grouping, flattening, collecting to a map — plus four behaviours that cause bugs not looking like stream bugs.

Java
·6 min read

HashSet vs HashMap: One Is Built Out of the Other

The difference is not two designs but one — javap shows a HashSet holding a HashMap. Every behaviour, and every failure mode, follows from that.

Java
·8 min read

ArrayList vs LinkedList: The Numbers Behind the Table

Everyone knows the complexity table. Here is what each operation actually costs when you time it — including the one result that contradicts the folklore.

Java
·13 min read

How to Set the JAVA_HOME Environment Variable on Windows, Linux, and macOS

Set JAVA_HOME correctly on Windows, Linux and macOS — find the JDK folder, make the variable stick across reboots, and fix the errors it causes.

Java
·9 min read

Difference Between JDK, JRE and JVM: What Each One Actually Does

JDK, JRE and JVM explained by following one file from javac to output: what each layer holds, why Oracle stopped shipping a JRE, and which one to install.

Java
·9 min read

How to Install Java 21 (JDK 21) on Windows

Install JDK 21 on Windows 10 or 11: choosing Temurin, Corretto or Oracle, the MSI checkboxes that matter, setting JAVA_HOME and PATH, fixing a wrong version.

Java