Tagged articles
ValueOf
10 articles · Page 1 of 1
This article walks beginners through Go's reflect package, covering the core functions TypeOf and ValueOf, the reflect.Kind constants, a step‑by‑step parsing flow, concrete handling of structs, maps, slices, pointers, primitive types, and the full set of Type and Value methods.
GoReflectionTypeOf
0 likes · 9 min read

In Java, comparing two Integer objects with == yields false for 1000 but true for 100 because the language caches small integer instances (-128 to 127) via Integer.valueOf, causing both variables to reference the same object only within that range.
AutoboxingInteger cachingJava
0 likes · 4 min read

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

This article explains how to make an object appear equal to two distinct values by exploiting the valueOf method in JavaScript and a custom equalsTo method in Java, showing step‑by‑step code examples and the underlying state‑changing logic.
JavaJavaScriptObject Comparison
0 likes · 6 min read

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 cachingJavaReference Equality
0 likes · 4 min read


政采云技术Jun 21, 2022 · Frontend Development
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

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 {} == !{}.
JavaScriptStringType Conversion
0 likes · 10 min read
![Why Does [] == ![] Evaluate to True? Unraveling JavaScript Type Conversion](https://wsrv.nl/?url=http%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FRqbfwXSnN36SNZjGLThuBmzjNwkyHE0kictB4jLqERv8uQox3mpkib38pwk0XzOCRicfFRGh89iaSx9OoL3PO02vnQ%2F0%3Fwx_fmt%3Djpeg)
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.
PrintingStringBuilderValueOf
0 likes · 7 min read


21CTOJul 22, 2017 · Fundamentals
This article explains why Java’s Integer.valueOf may produce unexpected true/false results by revealing the compiler’s insertion of valueOf calls, the inner IntegerCache mechanism that caches values from –128 to 127, and how these affect object creation and program output.
IntegerCacheJVMJava
0 likes · 3 min read


21CTOJul 12, 2017 · Fundamentals
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
