Tagged articles

autoboxing

33 articles · Page 1 of 1
Lisa Notes
Lisa Notes
Jun 25, 2026 · Fundamentals

Java Basics: Numbers, Characters, and String Handling – Day 53 Learning Notes

This tutorial walks through Java's core numeric and character utilities, covering number wrapper classes and autoboxing/unboxing, the Number hierarchy, formatted output with printf/format, DecimalFormat patterns, and the Math class’s constants and methods for arithmetic, logarithmic, trigonometric, and random number generation, all illustrated with concrete code examples.

DecimalFormatJavaMath
0 likes · 15 min read
Java Basics: Numbers, Characters, and String Handling – Day 53 Learning Notes
Java Tech Workshop
Java Tech Workshop
May 1, 2026 · Fundamentals

7 Crucial Differences Between Java int and Integer You Must Know

This article explains the seven key differences between Java's primitive int and its wrapper Integer, covering default values, memory layout, comparison pitfalls, caching, autoboxing/unboxing, performance impact, and appropriate usage scenarios with concrete code examples and benchmarks.

IntegerJavaNULL handling
0 likes · 22 min read
7 Crucial Differences Between Java int and Integer You Must Know
DevOps Coach
DevOps Coach
Dec 27, 2025 · Fundamentals

Why Does Integer == Fail for 128? Unveiling Java’s Autoboxing Cache

The article explains why comparing two Integer objects with `==` returns true for values within -128 to 127 but false for larger numbers, detailing Java’s integer cache, reference vs. value equality, and the correct use of `.equals()` to avoid subtle bugs.

JavaReference Equalityautoboxing
0 likes · 6 min read
Why Does Integer == Fail for 128? Unveiling Java’s Autoboxing Cache
Shepherd Advanced Notes
Shepherd Advanced Notes
Nov 18, 2024 · Fundamentals

Why Java’s Ternary Operator Can Throw NPE: Autoboxing Pitfalls Explained

The article explains how Java’s ternary operator can cause NullPointerException when type inference leads to automatic unboxing of a null wrapper, demonstrates this with concrete code examples, decompiled bytecode, and offers strategies such as using consistent types or replacing the ternary with if‑else.

JavaNullPointerExceptionautoboxing
0 likes · 11 min read
Why Java’s Ternary Operator Can Throw NPE: Autoboxing Pitfalls Explained
Su San Talks Tech
Su San Talks Tech
Oct 3, 2024 · Backend Development

Master Java’s Syntactic Sugar: 10 Features That Simplify Your Code

This article explains what syntactic sugar is, outlines its benefits such as readability, reduced boilerplate, and lower error rates, and then showcases ten concrete Java syntactic‑sugar features—including autoboxing, enhanced for‑loops, generics, varargs, try‑with‑resources, lambdas, method references, string concatenation, switch expressions, and type inference—complete with code examples.

Backend DevelopmentCode SimplificationJava
0 likes · 7 min read
Master Java’s Syntactic Sugar: 10 Features That Simplify Your Code
DaTaobao Tech
DaTaobao Tech
Aug 23, 2024 · Fundamentals

Common Java Pitfalls and Their Solutions

The article outlines frequent Java pitfalls—including BigDecimal precision loss, immutable lists from Arrays.asList, double division by zero returning Infinity, null values in switch statements, stream filters mutating original objects, and autoboxing nulls causing NullPointerExceptions—and provides clear explanations and practical fixes to enhance code reliability.

Arrays.asListBigDecimalJava
0 likes · 5 min read
Common Java Pitfalls and Their Solutions
IT Services Circle
IT Services Circle
Jul 16, 2022 · Fundamentals

Common Java Pitfalls: Equality, Objects.equals, BigDecimal, Streams, Autoboxing, and String Replacement

This article explains six frequent Java pitfalls—including misuse of the == operator with Integer, subtle bugs in Objects.equals, precision loss with BigDecimal constructors, reference sharing in Stream.filter, NullPointerExceptions from autounboxing, and differences between replace, replaceAll, and replaceFirst—providing code examples and best‑practice recommendations.

BigDecimalJavaStreams
0 likes · 12 min read
Common Java Pitfalls: Equality, Objects.equals, BigDecimal, Streams, Autoboxing, and String Replacement
Su San Talks Tech
Su San Talks Tech
Jul 15, 2022 · Fundamentals

6 Common Java Pitfalls Every Developer Should Avoid

This article walks Java developers through six frequent pitfalls—including misuse of the == operator, subtle bugs in Objects.equals, precision issues with BigDecimal, unexpected Stream filter behavior, autoboxing/unboxing surprises, and string replace quirks—offering clear explanations, code examples, and best‑practice solutions to help avoid costly bugs.

BigDecimalJavaStreams
0 likes · 13 min read
6 Common Java Pitfalls Every Developer Should Avoid
IT Xianyu
IT Xianyu
Jan 24, 2022 · Fundamentals

Why does Java evaluate 1000==1000 as false while 100==100 evaluates to true?

The article explains that Java's Integer caching for values between -128 and 127 causes small integer objects to be shared, making == true for 100, whereas larger integers like 1000 are distinct objects, so == returns false, and it demonstrates this behavior with code and reflection examples.

IntegerJavaReferenceEquality
0 likes · 4 min read
Why does Java evaluate 1000==1000 as false while 100==100 evaluates to true?
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Dec 29, 2020 · Fundamentals

Understanding Java Syntactic Sugar: Generics, Autoboxing, Enums, Inner Classes, Varargs and More

This article explains the concept of syntactic sugar in Java, covering generics, autoboxing/unboxing, enums, inner classes, variable‑length arguments, enhanced for‑loops, switch on strings, conditional compilation, assertions, try‑with‑resources, and string concatenation, with code examples and byte‑code analysis.

EnumsVarargsautoboxing
0 likes · 17 min read
Understanding Java Syntactic Sugar: Generics, Autoboxing, Enums, Inner Classes, Varargs and More
Programmer DD
Programmer DD
Sep 16, 2020 · Backend Development

Why Does Integer == Return True for Small Numbers? Uncover Java’s Integer Cache

This article explains why the == operator returns true for small Integer values in Java, detailing the internal IntegerCache mechanism, demonstrating the behavior with code examples, and showing how reflection can manipulate the cache, highlighting both the benefits and potential pitfalls of this optimization.

Reference EqualityReflectionautoboxing
0 likes · 4 min read
Why Does Integer == Return True for Small Numbers? Uncover Java’s Integer Cache
Java Captain
Java Captain
Dec 12, 2017 · Fundamentals

Understanding Integer and String Comparison in Java

This article explains Java's Integer and String comparison quirks, detailing how autoboxing caches values between -128 and 127, why '==' behaves differently for objects versus primitives, and demonstrates these concepts with clear code examples and explanations.

CachingIntegerObject Comparison
0 likes · 7 min read
Understanding Integer and String Comparison in Java
Java Backend Technology
Java Backend Technology
Nov 27, 2017 · Fundamentals

Why Swapping Two Integers Fails in Java? Exploring Pass‑by‑Value, Handles, and Integer Caching

This article dissects a Java interview question about swapping two Integer variables, explaining Java's pass‑by‑value semantics, the difference between handle‑based and direct pointer object access, Integer immutability, autoboxing, the IntegerCache mechanism, and how reflection can (or cannot) modify private final fields.

Integer cachingJDKReflection
0 likes · 10 min read
Why Swapping Two Integers Fails in Java? Exploring Pass‑by‑Value, Handles, and Integer Caching
Beike Product & Technology
Beike Product & Technology
Aug 15, 2017 · Mobile Development

Optimizing Android Memory Usage by Avoiding Autoboxing in Long Objects

This article discusses memory optimization in Android apps by addressing excessive object allocations caused by autoboxing Long values, leading to performance issues during feed scrolling. The solution involves implementing a custom data structure to reduce memory usage and improve application responsiveness.

Android optimizationData StructuresMemory Management
0 likes · 8 min read
Optimizing Android Memory Usage by Avoiding Autoboxing in Long Objects
Qunar Tech Salon
Qunar Tech Salon
Mar 21, 2015 · Fundamentals

Understanding Null in Java: Causes, Behaviors, and Best Practices

This article explains the role of the null keyword in Java, its default value for reference types, common pitfalls such as NullPointerException caused by autoboxing, improper primitive assignments, instanceof checks, static method calls on null references, and safe handling techniques to write null‑safe code.

InstanceofJavaNULL
0 likes · 12 min read
Understanding Null in Java: Causes, Behaviors, and Best Practices