Browse by Topic

Popular

Latest

Latest Java Posts

Comparison of Java text block and string literal syntax showing multi-line vs escaped string.
Java

Java Text Block vs String Literal: Key Differences

java text block vs string literal: Compare Java text blocks and string literals: syntax, escaping, formatting, and when each approach fits better in real code.

JavaText BlocksString LiteralsMulti-line Strings
Illustration comparing Java reference equality with the equals() method, showing two objects with matching content but different memory references.
Java

Java == vs equals: Reference vs Value Comparison

java == vs equals: Learn when to use == vs equals() in Java, covering reference vs value comparison, string interning, Integer caching, and the equals-hashCode contract.

java-equalityobject-comparisonstring-interninghashcode-contract
Illustration of a binary search splitting a sorted list in half, with Java Collections logo elements
Java

Using Java Collections.binarySearch on Sorted Lists

Learn how to use Java Collections.binarySearch correctly: sorted-list prerequisites, return value semantics, comparator usage, and performance tradeoffs.

Java CollectionsBinary SearchComparatorSorted List
Diagram comparing compile-time method resolution with runtime dynamic dispatch in Java
Java

Java Compile Time vs Runtime Polymorphism

Understand Java compile-time polymorphism via method overloading, runtime polymorphism via method overriding, and the practical differences in binding and API design.

JavaPolymorphismMethod OverloadingMethod Overriding
Diagram comparing a primitive variable holding a value directly against a reference variable pointing to a heap object.
Java

Java Reference Type vs Primitive Type in Practice

Understand how Java primitive and reference types differ in assignment, equality, null handling, memory cost, and when each type is the right choice.

Java typesPrimitive typesReference typesAutoboxing
A visual comparison of mutable and immutable Java objects, showing state changes versus fixed state.
Java

Java Mutable vs Immutable: When to Use Each

Learn how mutable and immutable objects differ in Java, including thread-safety and allocation tradeoffs, and when to choose each approach.

JavaImmutabilityMutable ObjectsThread Safety
Comparison of Java Duration and Period for time and date calculations
Java

Java Duration vs Period: When to Use Each

java duration vs period: Compare Java Duration and Period to handle time-based and date-based calculations correctly. Learn syntax, conversion, and pitfalls.

java.timeDurationPerioddate-time API
Comparison of Java LocalDate and LocalDateTime showing date-only and date-time representations
Java

Java LocalDate vs LocalDateTime: When to Use Each

Compare Java's LocalDate and LocalDateTime types, learn when each is the right choice, and see how to convert between them with Java examples.

JavaLocalDateLocalDateTimeDate and Time API
Illustration comparing Java Future's blocking get() with CompletableFuture's non-blocking composition pipeline.
Java

Java Future vs CompletableFuture: When to Use Which

java future vs completablefuture: Compare Java Future and CompletableFuture: blocking behavior, composition, error handling, and when each API fits your async workflow.

JavaCompletableFutureFutureConcurrency
Illustration comparing synchronized lock and volatile variable in Java concurrency
Java

java synchronized vs volatile: Choosing the Right Concurrency Tool

java synchronized vs volatile: Understand the differences between synchronized and volatile in Java: memory visibility, atomicity, performance, and when to use each.

concurrencymultithreadingmemory visibilityatomicity