Tag

valueOf

0 views collected around this technical thread.

Architecture Digest
Architecture Digest
Sep 12, 2023 · Fundamentals

Understanding Java Integer Caching and the == Operator

This article explains how Java caches Integer objects in the range -128 to 127, why the == operator behaves differently for small and large integers, and demonstrates how to inspect and manipulate the cache using reflection.

JavaMemory OptimizationReference Equality
0 likes · 4 min read
Understanding Java Integer Caching and the == Operator
政采云技术
政采云技术
Jun 21, 2022 · Frontend Development

How to Make the Expression x == 1 && x == 2 && x == 3 True in JavaScript

This article explains how to satisfy the JavaScript expression x == 1 && x == 2 && x == 3 by understanding the differences between loose (==) and strict (===) equality, type coercion rules, and implementing custom valueOf or toString methods on objects to increment a counter during each comparison.

EqualityJavaScriptLoose Equality
0 likes · 9 min read
How to Make the Expression x == 1 && x == 2 && x == 3 True in JavaScript
KooFE Frontend Team
KooFE Frontend Team
Aug 30, 2021 · Frontend Development

Why Does [] == ![] Evaluate to True? Unraveling JavaScript Type Conversion

This article explains JavaScript’s explicit and implicit type conversion mechanisms—including Number(), String(), Boolean(), toString and valueOf—through detailed code examples and clarifies puzzling expressions like [] == ![] and {} == !{}.

Boolean()JavaScriptNumber
0 likes · 10 min read
Why Does [] == ![] Evaluate to True? Unraveling JavaScript Type Conversion
Java Captain
Java Captain
Dec 22, 2018 · Fundamentals

Why Printing a Null Object in Java Does Not Throw an Exception

This article explains why Java's print methods output the literal "null" instead of throwing a NullPointerException, by examining the source code of PrintStream.print for both String and Object arguments, the behavior of String.valueOf, and the compiler‑generated StringBuilder handling of null during concatenation.

FundamentalsJavaStringBuilder
0 likes · 7 min read
Why Printing a Null Object in Java Does Not Throw an Exception