"On the Java platform, numbers are physically stored as JVM primitive types, unless we need a nullable number reference (e.g.
Int?
) or generics are involved. In the latter cases numbers are boxed." What does it mean by boxed?
m
Marcin Bak
03/17/2020, 10:21 AM
wrapped in Java instance of Integer class (for example)
m
Michael de Kaste
03/17/2020, 10:47 AM
What Marcin said
A java int is a JVM primitive and always needs to have a value.
In order to make that int nullable; e.g. have no value. You can put that int into a class holding only that value:
class Integer(
val value: int
)
since Integer can be nullable, the whole int can be nullable.