Tagged articles
9 articles
Page 1 of 1
Java Tech Enthusiast
Java Tech Enthusiast
Sep 21, 2025 · Fundamentals

How an Object Can Equal Two Different Values in JavaScript and Java

This article explains the clever trick of making a single object satisfy multiple equality checks in JavaScript using a mutable valueOf method, and shows how a similar effect can be achieved in Java through custom methods and state variables, highlighting the underlying mechanism.

JavaScriptMethod OverloadingObject Comparison
0 likes · 6 min read
How an Object Can Equal Two Different Values in JavaScript and Java
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.

Integer cachingJavaMemory Optimization
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.

Loose EqualityToPrimitiveType Conversion
0 likes · 9 min read
How to Make the Expression x == 1 && x == 2 && x == 3 True in JavaScript
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.

Printingfundamentalsnull pointer
0 likes · 7 min read
Why Printing a Null Object in Java Does Not Throw an Exception
21CTO
21CTO
Jul 12, 2017 · Fundamentals

Why Does Java’s Integer.valueOf Return Cached Objects? The Hidden Mechanism Explained

An in‑depth look at a famous Java interview puzzle reveals how the compiler injects valueOf calls, how the Integer class caches values via an internal IntegerCache, and why numbers between –128 and 127 are reused, providing essential insight for developers preparing for technical interviews.

CachingIntegerInterview
0 likes · 3 min read
Why Does Java’s Integer.valueOf Return Cached Objects? The Hidden Mechanism Explained