Boxed primitive
A boxed primitive is a reference or object type that represents a corresponding primitive value and provides object semantics, including possible nullability.
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.
Related concepts
- nullable typeused by · A nullable type is a type whose values may be either a value of the underlying type or an explicit representation of absence, such as null.
- float64includes · Float64 is a 64-bit floating-point numeric type, commonly represented using the IEEE 754 binary64 format.
- primitive data typealternative to · A primitive data type is a fundamental, language-provided type for representing a basic value, rather than a composite of multiple values.
- specialized primitive collectionalternative to · A specialized primitive collection is a collection implementation that stores primitive values directly and provides operations accepting those values without boxing.
- implicit conversionuses · Implicit conversion is an automatic change of a value from one type to another according to language rules, without an explicit conversion operation in the source code.
- conditional logicproduced by · Conditional logic is a programming technique that selects execution paths, actions, or result values according to evaluated conditions.
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.

