Kotlin’s type system differentiates between nullable and non-nullable types. By default, types are non-nullable; you cannot get a null pointer exception from dereferencing it.
This is why Kotlin’s basic data types, such as
Int, can map safely to Java’s primitive types, such as
int, in the bytecode. Both can never be
Thus, all objects and types you’ve seen so far in this course were non-nullable. Trying to assign
null to them would cause a compile-time error: