liveBook · Manning

Boxed primitive

A boxed primitive is a reference or object type that represents a corresponding primitive value and provides object semantics, including possible nullability.

How 2 Manning books explain it

100 Java Mistakes and How to Avoid Them

A boxed primitive type is a reference type that wraps a Java primitive value, such as Integer wrapping int, and can represent null.

How it is used
Prevents null-unboxing and comparison mistakes when Java code uses primitive wrapper types.
How deep it goes
Explains conditional-expression type conversion and autounboxing consequences, while recommending if statements instead of memorizing all rules.
Examples
Uses Double value-or-zero conditionals, nested Integer mapping, a three-outcome confirmation, and cached Integer comparisons.
What you can do after
Diagnose/debug null-unboxing and unreliable wrapper equality, then replace fragile expressions with primitives, if statements, enums, or equals().

Read how 100 Java Mistakes and How to Avoid Them explains boxed primitive →

Kotlin in Action, 2E

A wrapper type is a Java reference type that represents a value of a corresponding primitive type, such as Integer for int.

How it is used
Explains JVM representation choices behind Kotlin numeric types, especially during Java interoperability, null handling, and generic collection use.
How deep it goes
Traces boxing from Java’s primitive-reference distinction through Kotlin syntax, nullable types, generic limitations, and collection consequences.
Examples
Uses Int declarations, List<Int>, nullable Person.age, and comparisons involving missing ages.
What you can do after
Evaluate when Kotlin values become Java wrappers and choose nullable types, collections, arrays, or specialized storage accordingly.

Read how Kotlin in Action, 2E explains boxed primitive →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.